Javascript Fetch.js正在处理结果。然后是语法
我有一个fetch语句,它必须返回一个“options”对象 这是我构建的语句Javascript Fetch.js正在处理结果。然后是语法,javascript,fetch-api,Javascript,Fetch Api,我有一个fetch语句,它必须返回一个“options”对象 这是我构建的语句 const task = fetch('/api/SelectData/QuerySuburbs' + queryString, { method: 'GET', headers: headers, }) .then(handleErrors) .then(response => response.json()) .then(response => {o
const task = fetch('/api/SelectData/QuerySuburbs' + queryString, {
method: 'GET',
headers: headers,
})
.then(handleErrors)
.then(response => response.json())
.then(response => {options: response}))
我知道这是不正确的,而且我在选项名称上得到一个错误,说它是一个“未使用的标签”
我想从中返回一个包含返回响应的“options”对象。当它返回类似“选项:响应”的“任务”时,我如何构造语法?在最后一行中,在
{
之前应该有一个(
)。您在这个问题中是否错过了它,或者这可能是问题所在?在不带{}的箭头函数中,需要返回一个对象,将对象括在()…因此。然后(response=>({options:response}))
Jaromanda-squgeim-我认为这就是问题所在。语法错误。