How to find value (true or false) from ajax respond
I have written a script register user. And in th elast step i need value
true or false from a function to find that email is already existed or
not.
In function do_register(user_email)
if (!isemailexist(user_email)) {
document.getElementById("error").innerHTML="email is already exist, please
change!!";
document.regForm.user_email.focus()
return false;
}
in function isemailexist ()
xmlHttp.onreadystatechange=function () {
if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
var str=xmlHttp.responseText;
var res=JSON.parse(str);
if (res[0]=="no"){
return false;
}
}
haha=xmlHttp.onreadystatechange.test(res[0]); ///I used test(); methode to
in order to find value true or false
}
I have tried alot but none of them could give me the true or false !
No comments:
Post a Comment