Reputation: 11452
I am trying to compare a success string with xhr.responseText
but it is not working, I have no idea why.
if (xhr.responseText == "success")
{
alert("Yay");
}
What could be the reason? I tried to alert the responseTest and it has exactly same value, "success" in it.
Upvotes: 0
Views: 203
Reputation: 207527
I bet there is something else there. It is better to use console.log instead of alert. Modern day browsers have a console built in.
alert(escape(xhr.responseText));
This will show you other characters that are not visible in the alert.
Upvotes: 1
Reputation: 939
if you are developer, i suposed that you are working on firefox with firebug, try to print the xhr.response object in order to debug your script with the following sentence: console.log(xhr.responseText);
Upvotes: 0