XMLHttpRequest

https://blog.csdn.net/linzhiqiang0316/article/details/52326773、

readyState存着XMLHttpRequest的状态

 0: 请求未初始化

 1: 服务器连接已建立

 2: 请求已接收

 3: 请求处理中

 4: 请求已完成,且响应已就绪

实例

this.xmlhttp = new XMLHttpRequest();

this.xmlhttp.onreadystatechange = this.callbacksuccess(); //回调函数

this.xmlhttp.open('post',url,true); //发送ajax

this.xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");

this.xmlhttp.send(body); //get时data为null

原文地址:https://www.cnblogs.com/7q4w1e/p/9549626.html