An open API service indexing awesome lists of open source software.

https://github.com/ebertti/js-csrf-django

Simple javascript to make easy to make POST with AJAX using Django. Based on django documentation
https://github.com/ebertti/js-csrf-django

Last synced: 12 months ago
JSON representation

Simple javascript to make easy to make POST with AJAX using Django. Based on django documentation

Awesome Lists containing this project

README

          

js-csrf-django
==============

Simple javascript to make easy to make POST with AJAX using Django. Based on django documentation.

Installation
------------

1. Add ``CsrfViewMiddleware`` in your ``MIDDLEWARE_CLASSES`` in ``settings.py`` file of your project.
``` python
MIDDLEWARE_CLASSES = (
...
'django.middleware.csrf.CsrfViewMiddleware',
...
)
```

2. Add the javascript file ``https://raw.github.com/ebertti/js-csrf-django/master/csrf.js`` in the ``head`` of your html page, rather in yout ``base.html``, after jQuery file:
```html







```
3. Now you can make your AJAX request using POST.

[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/ebertti/js-csrf-django/trend.png)](https://bitdeli.com/free "Bitdeli Badge")