原生js的ajax请求怎么写?
1 回答

慕标琳琳
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
提交
取消