ajax 四部曲
2020-03-17 本文已影响0人
Spidd
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);
}