我对一个特定的问题感到困惑。我正在尝试使用提取API设置Cookie,但无法这样做。
static deleteorder = (domain = "http://localhost:8080/pc", order) => {
let cooks = "JSESSIONID=AFAFWEEVV2323GG";
fetch(deleteorder, {
method: `GET`,
credentials: 'same-origin',
headers: {
"Content-type": `application/x-www-form-urlencoded`,
},
})
.then(res => {
console.log(res.status);
})
.catch(error => {
console.log(error);
});
};
}
当函数运行并返回200
时,但数据保持不变,表示顺序保持不变。你们中的一个可以阐明吗?我正在学习fetch api的初级阶段,因此,我们将不胜感激任何反馈。
[Fetch()
只是发送当前文档的cookie,因此只需将cookie添加到document.cookie
。
static deleteorder = (domain = "http://localhost:8080/pc", order) => {
document.cookie = "JSESSIONID=AFAFWEEVV2323GG";
fetch(deleteorder, {
method: `GET`,
credentials: 'same-origin',
})
.then(res => {
console.log(res.status);
})
.catch(error => {
console.log(error);
});
};