AJAX 核心三部曲[@more@]
| |
//创建对象 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; } } } |
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/219138/viewspace-914339/
,如需转载,请注明出处,否则将追究法律责任。