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.
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.
This will show you other characters that are not visible in the alert.