我的 django 模板中有以下 JS 代码:
fetch("http://127.0.0.1:8000/api/endpoint", {
method: "POST",
body: $("#form").serializeArray(),
}).then(function(data) {
});
在 api/endpoint 中,我得到:
Forbidden (CSRF token missing or incorrect.): /api/endpoint
如何在 fetch 中添加 csrf 令牌?
慕无忌1623718
紫衣仙女
慕姐8265434
相关分类