【发布时间】:2018-05-07 11:53:36
【问题描述】:
fetch('http://www.freegamesforyourwebsite.com/feeds/games/?
tag=platform&limit=100&format=json',
{
method:'GET',
mode:'no-cors',
dataType: 'json',
headers: {
'Accept': 'application/json'
}
}).then(response =>
response.json()).then(addImage).catch(e => requestError(e,'image'));
控制台日志
SyntaxError: Unexpected end of input
at fetch.then.response ((index):159)
at <anonymous>
我尝试在 cros 平台上使用 fetch json,为什么 Google 开发者工具中的请求标头显示我提供的请求标头。并且预览部分可以显示我的 json 响应,但是响应承诺之后的承诺无法读取数据和错误发生在上面的控制台日志中。我获取的URL是开源的,每个人都可以使用。
感谢任何帮助。
【问题讨论】:
标签: javascript json fetch-api