小编Mat*_*att的帖子

fetch()意外的输入结束

我使用fetch()从api服务器获取数据.我的错误看起来像这样:

Uncaught (in promise) SyntaxError: Unexpected end of input at 
  fetch.then.blob.
Run Code Online (Sandbox Code Playgroud)

你能告诉我我做错了什么吗?

const weatherAPi ='https://www.metaweather.com/api/location/523920';
fetch(weatherAPi, {
  mode: 'no-cors'
}).then(blob => blob.json())
  .then(data => console.log(data))
Run Code Online (Sandbox Code Playgroud)

javascript json cors fetch-api

26
推荐指数
5
解决办法
3万
查看次数

标签 统计

cors ×1

fetch-api ×1

javascript ×1

json ×1