跳到主要内容

response

2024年04月17日
柏拉文
越努力,越幸运

一、认识


ajax.response 返回响应的正文。返回的类型为 ArrayBuffer、Blob 、 Document、JavaScript Object 或 DOMString 中的一个。这取决于 responseType 属性。

二、语法


const ajax = new XMLHttpRequest();
ajax.open("get","htt://localhost:4000/api",true);
ajax.readystatechange = function(){
if(ajax.readyState === 4){
console.log(xhr.response);
}
};
ajax.send();