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);
}

上一篇 下一篇

猜你喜欢

热点阅读