var xhr = new XMLHttpRequest();
xhr.open('GET','url',true) ;//true,false代表是否异步,一般都是true
xhr.send();
xhr.onreadystatechange = function (){
console.log(xhr.readyStates)//2,3,4 分别代表请求已接收,请求处理中,请求以完成
if(xhr.readyState==4&&xhr.status==200){//xhr.status http请求结果的状态码
console.log(xhr.responseText)
}
}