const getJson = () => {
const xhr = new XMLHttpRequest();
xhr.open("GET", url, true); // url 请求地址
// xhr.responseType = "blob"; // json格式不需要
xhr.onload = function() {
if (xhr.status === 200) {
console.log(xhr.response, "=====");
}
};
xhr.send();
};
使用new XMLHttpRequest请求JSON数据
最新推荐文章于 2024-07-26 16:20:18 发布
关键词由CSDN通过智能技术生成