简体   繁体   中英

django and csrf_token problem

I have a little problem with the token in django.

When I write a POST form and add {{csrf_token}}, when I submit it the token is checked .

But when I send a POST request (in ajax) and add the paramater manually csrfmiddlewaretoken , the token is not checked.

But I don't know why ?

Thanks.

AJAX requests are not checked for CSRF: the browser's same origin policy means that CSRF attacks are much harder. See the explanation in the docs .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM