如题,代码如下:
const URL = 'http://api.xx.com/?q='
let req = URL + word
fetch(req)
.then(res => res.json())
.then(res => console.log(res)
.catch(err => console.log(err)
在本地调试的时候,由于跨域不能访问,请问跨域的情况下该如何使用fetch
如题,代码如下:
const URL = 'http://api.xx.com/?q='
let req = URL + word
fetch(req)
.then(res => res.json())
.then(res => console.log(res)
.catch(err => console.log(err)
在本地调试的时候,由于跨域不能访问,请问跨域的情况下该如何使用fetch
13 回答12.6k 阅读
7 回答1.7k 阅读
3 回答1k 阅读✓ 已解决
3 回答1.2k 阅读✓ 已解决
2 回答1.1k 阅读✓ 已解决
2 回答1.8k 阅读
2 回答1k 阅读✓ 已解决
你的
http://api.xx.com/?q=
返回header里有正确设置Access-Control-Allow-Origin
吗?