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

 

posted @ 2018-08-28 17:20  萧韶九成  阅读(133)  评论(0编辑  收藏  举报