I am working on an AJAX system to submit a form, but I can’t even get my JavaScript to load, the Firebug report is below.
missing ) after argument list
else if( httpRequest.responseText == 'already logged in' )\n
I poked around the internet and SO, but all I found was errors in quoting. (Example, Another Example). I don’t have anything misquoted, so I really don’t see what is going on. More of my code is below.
(Some unrelated function calls to remove loading messages are removed.)
if(httpRequest.responseText != "failure") // Works fine!
{
document.getElementById("result").innerHTML = "[Success message]";
setTimeout("2000", function(){ window.location.assign("[link to page]");
}
else if(httpRequest.responseText == 'already logged in') // Similar to above, but fails
{
document.getElementById("result").innerHTML = "[error message]";
}
else
{
document.getElementById("result").innerHTML = "[error message]";
}
Might anyone know why this error is called?
(For more members, it might be useful to outline what things cause this error, which would allow this page to work with other code)
If you split your code up a bit more you see the problem:
So you are missing a } and a );
Edit: The order of the arguments is wrong as well like Caspar pointed out.