ajax

var xhr=window.XMLHttpRequest?new XMLHttpRequest():new ActiveXObject("Microsoft.XMLHTTP");
xhr.onreadystatechange=function () {
if(xhr.readyState==4&&xhr.status==200){
console.log(this.responseText);
}else{
console.log("失败");
console.log(xhr.getAllResponseHeaders());
}
}
xhr.open("get","1.txt");
xhr.send();
posted @ 2019-11-27 00:53  Hi前端  阅读(106)  评论(0编辑  收藏  举报