<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异步访问数据库,进行判断
最新推荐文章于 2024-07-10 22:41:59 发布