Javascript 如何使用fetch函数删除数据?

Javascript 如何使用fetch函数删除数据?,javascript,fetch,Javascript,Fetch,这是我的密码 var url = '/deltopics?_id=' + item._id; fetch(url, { method: 'delete', credentials: 'include' }).then(function(res) { return res.json(); }).then(function(data) { that.refresh(0, author); ui.tips('delete success') }).catch(

这是我的密码

var url = '/deltopics?_id=' + item._id;

fetch(url, {
    method: 'delete',
    credentials: 'include'
}).then(function(res) {
    return res.json();
}).then(function(data) {
    that.refresh(0, author);
    ui.tips('delete success')
}).catch(function(err) {
    console.log(err)
})
但这不起作用吗


有人能帮我吗?

你对“不起作用”的定义是什么?这似乎很明显,但你也可以提供一个提示,说明你正在使用哪个js框架和插件。