尝试DELETE
使用 fetch polyfill 发出请求,但我得到Uncaught TypeError: Cannot read property 'then' of undefined
了,这是错误promise.then()
这是我的做法:
function deleteData(item, url) {
fetch(url + '/' + item, {
method: 'delete'
}).then(response => {
return response.json();
});
}
另一方面,当我/GET
提出请求时,一切正常:
function fetchData(url) {
return fetch(url).then(response =>
response.json().then(json => {
return json;
})
);
}
知道我做错了什么吗?