原生js的ajax请求怎么写?
1 回答
![?](http://img1.sycdn.imooc.com/545863aa00014aa802200220-100-100.jpg)
慕标琳琳
TA贡献1830条经验 获得超9个赞
var xhr = new XMLHttpRequest();
xhr.open("post","test.php",true);
xhr.send();
xhr.onreadystatechange = function() {
if(xhr.readyState == 4 && xhr.status == 200) {
alert(xhr.responseText);
}
}
添加回答
举报
0/150
提交
取消