【发布时间】:2020-06-02 18:47:48
【问题描述】:
我只是不知道出了什么问题。我正在尝试使用 javascript 中的 fetch 从 api 获取 json。这是代码:
function get(){
fetch('http://localhost:8082/marca/listar', {
method: 'GET',
headers: {},
mode: 'no-cors', // <---
cache: 'default'
})
.then(Response => { return Response.json() })
.then(data => {
console.log(data.nombre)
});
}
我收到以下错误:
【问题讨论】:
-
你能发布你遇到的错误吗?
标签: javascript api web get fetch