csrf with ajax and django post

混江龙づ霸主 提交于 2019-12-04 09:13:19

You need to (as the document you linked to suggests) copy that entire ajaxSend method ...

You dont need to modify it in any way - it is a complete solution - the ajaxSend method is actually an event handler for the ajaxSend event. Its triggered when you use the .ajax method in jQuery. See the ajaxSend docs here

The method linked in the above document appends the correct X-CSRFToken header to your AJAX request. You can then use your first method for sending the AJAX request.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!