ajax原装js版本
var fastAJax = function(args) {
var xmlhttp = null;
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
} else if (window.ActiveXObject) {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
if (xmlhttp == null) {
args.handler("notSupport");
} else {
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4) {
if (xmlhttp.status == 200) {
args.handler(xmlhttp.responseText);
} else {
args.handler(xmlhttp.statusText);
}
}
};
xmlhttp.open(args.type,args.url, true);
xmlhttp.send(args.data);
}
};
版权声明:本文为李维亮博主的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:http://www.liweiliang.com/797.html
- 上一篇: 犹太人富过300年 全靠的是这个
- 下一篇: 前端构建工具gulpjs的使用介绍及技巧
评论已关闭