
然后切换到控制台输入参数后回车
fetch("http://xxxxxx......
")
.then(r => {
if (r.ok) {
return r.json(); // 假设我们要解析JSON
}
throw new Error('Network response was not ok.');
})
.then(d=> {
console.log(d); // 打印获取到的数据
})
.catch(e => {
console.error('Fetch error:', e); // 打印错误信息
});