收藏本站 收藏本站
积木网首页 - 软件测试 - 常用手册 - 站长工具 - 技术社区
积木学院 > 程序开发 > Ajax技术 > 正文

Ajax通用模板实现代码

来源:互联网 日期:2013-07-21 15:27
 
<script type="text/javascript">
var xmlHttp;

function creatXMLHttpRequest() {
if (window.ActiveXObject) {
xmlHttp = new ActiveXObject("Microsoft.XMLHttp");
}
else if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
}

}
function startRequest() {
creatXMLHttpRequest();
xmlHttp.onreadystatechange = handleStateChange;
xmlHttp.open("GET", "simpleResponse.xml", true);
xmlHttp.send(null);

}
function handleStateChange() {
if (xmlHttp.readyState == 4) {
if (xmlHttp.status == 200) {
// document.getElementById("results").innerHTML = xmlHttp.responseText;
// alert("The server replied with:" + xmlHttp.responseText);
}
}

}
</script>

推荐阅读

 

热点信息

 
强悍的草根IT技术社区,这里应该有您想要的!
Copyright © 2010 Gimoo.Net. All Rights Rreserved  京ICP备05050695号