码迷,mamicode.com
首页 > Web开发 > 详细

ajax的4个步骤

时间:2014-10-26 15:36:14      阅读:178      评论:0      收藏:0      [点我收藏+]

标签:http   io   os   ar   sp   on   log   cti   ad   

// 创建xmlhttpRequest对象
var xh=null;
if(window.ActiveXObject){
xh=new ActiveXObject("Microsoft.XMLHTTP");
}
else if(window.XMLHttpRequest){
xh= new XMLHttpRequest();
}
//第二步 设置回调函数,状态变化后所执行的函数
xh.onreadystatechange = function() {
if (xh.readyState == 4) {
if (xh.status == 200) {
console.log(xh.pesponseText);
}
}
}
//第三步 设置method和地址action
xh.open(‘get‘,/querystu);
//第四步 发送
xh.send();

ajax的4个步骤

标签:http   io   os   ar   sp   on   log   cti   ad   

原文地址:http://www.cnblogs.com/Angelinvestment/p/4052009.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!