ajax获取服务器响应信息
时间:2018-05-12 19:49:57
收藏:0
阅读:191
window.onload = function(){
document.getElementById(‘btn‘).onclick = function(){
var req = new XMLHttpRequest();
req.open(‘get‘, ‘demo.php‘);
req.onreadystatechange = function(){
if(req.readyState == 4 && req.statu == 200){
var str = req.responseText;
alert(str)
}
}
req.send();
}
}
原文:https://www.cnblogs.com/wangshengl9263/p/9029578.html
评论(0)