<script type="text/javascript">
var xmlhttp;
function loadXMLDoc(url){
xmlhttp=null;
if (window.XMLHttpRequest){// code for all new browsers
xmlhttp=new XMLHttpRequest();
}else if (window.ActiveXObject){// IE5 and IE6
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=stateChange;
xmlhttp.open("GET",url,true);//true表示继续执行后面的代码send(),而不必等待服务器的响应
xmlhttp.send(null);
}
function stateChange(){
if (xmlhttp.readyState==4){// 4 = "loaded"
if (xmlhttp.status==200){// 200 = OK
// 这里添加需要怎么处理的代码!
}else{
alert("出错啦!");
}
}
}
</script>
ajax基础框架
最新推荐文章于 2021-06-03 12:55:33 发布