ajax

〈script lanuage = "javaScript"〉
//创建对象
function createXMLHttpRequest(){
if(window.ActiveXObject){
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if(window.XMLHttpRequest){
xmlHttp = new XMLHttpRequest();
}
}
//前台界面事件调用的函数
function checkName(){
createXMLHttpRequest();
xmlHttp.onreadystatechange = handleStateChange;
var sql = "UserReg.aspx?";
xmlHttp.open("GET",sql,true);
xmlHttp.send(null);
}
//和服务器交互期间执行的函数
function handleStateChange(){
if(xmlHttp.readyState == 4){
if(xmlHttp.status == 200){
document.getElementById("divx").innerHTML = xmlHttp.responseText;
}
}
}
〈script〉
原文地址:https://www.cnblogs.com/aloha/p/1247856.html