var xmlHttp = null;
if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
} else if (window.ActiveXObject) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
var url = "/learningbar/login.do?param=check_user&username=" + escape(username)+"&email="+escape(email);
xmlHttp.open("POST", url, true);
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState == 4) {
if (xmlHttp.status == 200) {
if (xmlHttp.responseText == "01") {
alert("此用户名和邮箱都已存在,请重新填写!");
return false;
} else if (xmlHttp.responseText == "02") {
alert("此用户名已存在,请重新填写!");
return false;
} else if (xmlHttp.responseText == "03") {
alert("此邮箱已存在,请重新填写!");
return false;
} else if (xmlHttp.responseText == "04"){
o.form.submit();
}
}
}
};
xmlHttp.send(null);
return false;
}
ajax验证流程
最新推荐文章于 2022-05-10 08:47:48 发布