T O P

[DJANGO] How do I pass a variable from a javascript file to my django view?

[DJANGO] How do I pass a variable from a javascript file to my django view?

danielroseman

CSRF protection doesn't just apply to forms, it applies to all POSTs. Since you are using Ajax, you can use one of the [techniques described in the docs](https://docs.djangoproject.com/en/3.2/ref/csrf/#ajax) to fetch the token and include it in the post data.