let xhr = new XMLHttpRequest(); //1.创建创建XMLHttpRequest对象
xhr.open('GET','/user',true); //2.连接服务器
xhr.send(); // 3.发送请求
xhr.onload = function(){ // 4.接收数据
console.log(xhr.response);
}
let xhr = new XMLHttpRequest(); //1.创建创建XMLHttpRequest对象
xhr.open('GET','/user',true); //2.连接服务器
xhr.send(); // 3.发送请求
xhr.onload = function(){ // 4.接收数据
console.log(xhr.response);
}
本文标题:ajax 四部曲
本文链接:https://www.haomeiwen.com/subject/lqcxyhtx.html
网友评论