手机
当前位置:查字典教程网 >编程开发 >AJAX相关 >Ajax通用模板实现代码
Ajax通用模板实现代码
摘要:复制代码代码如下:varxmlHttp;functioncreatXMLHttpRequest(){if(window.ActiveXObj...

复制代码 代码如下:

<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>

【Ajax通用模板实现代码】相关文章:

Ajax读取数据到表格的实现代码

Ajax实现评论提交

ajax实现标签导航

php AJAX POST的使用实例代码

JavaScript实现Ajax总结

AJAX 用户唯一性验证实现代码

给初学ajax的人 ajax函数代码

asp.net+Ajax 文本文件静态分页实现代码

Ajax实现弹出式无刷新城市选择功能代码

Ajax 表单验证 实现代码

精品推荐
分类导航