【发布时间】:2019-05-22 17:36:35
【问题描述】:
我正试图从另一个站点获取 JSON 数据并对其进行解析,但出现错误提示
跨域读取阻塞 (CORB) 阻止了 MIME 类型为 application/json 的跨域响应 http://a-url。详情请见https://www.chromestatus.com/feature/5629709824032768。
function fetchdata() {
// Replace ./data.json with your JSON feed
fetch('[some-url-with-CORB]').then(response => {
return response.json();
}).then(data => {
// Work with JSON data here
console.log(data);
}).catch(err => {
// Do something for an error here
});
}
我打算获取 JSON 响应,然后从那里解析它,但 CORB 阻止了我这样做。
【问题讨论】:
标签: javascript json