<script type="text/javascript">
var xmlHttp;
function creatXmlHttp(){
if(window.XMLHttpRequest){
xmlHttp = new XMLHttpRequest();
}else if(window.ActiveXObject){
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
}
function doAjax(){
var memberUserName =document.getElementById("memberUserName").value;
creatXmlHttp();
xmlHttp.open("GET", "<%=path%>/frontwork/MemberUserAction.do?p=memberUserRegValidationActionForward&&otherAccount=" + memberUserName, true);
xmlHttp.onreadystatechange = dowork;
xmlHttp.setRequestHeader("If-Modified-Since","0");
xmlHttp.send(null);
}
function dowork(){
if (xmlHttp.readyState == 4) { // 测试状态是否请求完成
if (xmlHttp.status == 200) { // 如果服务端回应OK
var text = xmlHttp.responseText;
var spa = document.getElementById("msg");
spa.innerHTML = text;//将内容放入
}
}
}
</script>
Ajax异步访问数据库,进行判断
本文介绍了如何使用Ajax技术实现在会员注册过程中进行实时验证,提高用户体验。

被折叠的 条评论
为什么被折叠?



