问题描述
我第一次使用 fetch() 从 API 获取一些数据:'https://www.codewars.com/api/v1/users/thenarfer'。
我的目标是 console.log 数据。我相信数据采用 JSON 格式。
POST 或 GET 是正确的方法吗?我如何从这里继续?
fetch('https://www.codewars.com/api/v1/users/thenarfer',{
method: 'GET',mode: 'no-cors',credentials: 'include',body: JSON.stringify(data),headers: {
'Content-Type': 'application/json'
}
}).then((res) => res.json())
.then((data) => {
console.log(data)
})
.catch((err) => console.log(err));
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)