Korrekt måde at anvende jquery
Er nedenstående en korrekt måde at anvende jquery?
var login_callback = function(result) {
if (typeof result.action !== 'undefined' && typeof result.data !== 'undefined') {
if (result.action === 'login_form') {
var loginForm = ""
loginForm += '<form name=\"login\" id=\"login\" action=\"/\" method=\"post\">'
loginForm += ' <div>'
loginForm += ' <input size=\"20\" type=\"text\" maxlength=\"30\" name=\"username\" value=\"\"><br>'
loginForm += ' <input size=\"20\" type=\"password\" maxlength=\"20\" name=\"password\" value=\"\"><br>'
loginForm += ' <input type=\"submit\" name=\"submit\" value=\"log ind\">'
loginForm += ' </div>'
loginForm += '</form>'
$('#loginbox').html(loginForm);
} else if (result.action === 'try_again') {
var tryAgain = ""
tryAgain += '<span class=\"error_text\">'
tryAgain += ' Forkert brugernavn eller adgangskode.<br>'
tryAgain += '</span>'
tryAgain += '<br>'
tryAgain += '<a href=\"/\">Prøv igen</a>'
$('#loginbox').html(tryAgain);
} else if (result.action === 'logout') {
var logOut = ""
logOut += '<h3>'
logOut += ' Velkommen '+html(result.data)+'!'
logOut += '</h3'
logOut += '<br>'
logOut += '<a href=\"/\">Log ud</a>'
$('#loginbox').html(logOut);
}
}
};