I am trying to compare a string that is returned from servlet
Servlet page returns this:
out.println("pass");
JavaScript:
function Return() {
if (ajax.responseText === "pass") {
document.getElementById("pass").innerHTML = "This is valid number!";}
Now I have output the ("ajax.responseText")
and it returns "pass" but I can't still validate it in the IF statement.
I tried using (.equal("pass")
i tried with ==
and I even tried "var value = ajax.responseText;
and then tried value === "pass")
Yes I also tried .toString()
..
It just never validates it correctly it always goes to ELSE statement...