Jquery ajax

255 views
Skip to first unread message

Marko Tibold

unread,
Apr 22, 2012, 9:56:47 AM4/22/12
to django-res...@googlegroups.com
Hey all,

has any of you guys successfully implemented jquery ajax calls with the framework? 

There are some challenges in regard to sending a csrf token as I know so far.

It would be great if you could share some example code.

I'm happy to extend the http://django-rest-framework.org/howto.html section with a Jquery chapter based on any examples.

Regards,

Marko

User Name

unread,
Apr 22, 2012, 10:06:40 AM4/22/12
to django-res...@googlegroups.com
I'm interested in this too, since till now I usually wrap my view functions with @csrf_exempt for making Ajax calls though js/jquery.

Thanks!

Marko Tibold

unread,
Apr 22, 2012, 10:29:25 AM4/22/12
to django-res...@googlegroups.com
This snippet does the trick:


It adds a `X-Csrftoken` to the request header.
Reply all
Reply to author
Forward
0 new messages