Using AJAX in django
I am new to AJAX and django.
I have written my own XMLHttpRequest
call on browser side. I will have to manually set the header request.META['HTTP_X_REQUESTED_WITH']
to string XMLHttpRequest
.
How can I access 开发者_运维技巧these headers on browser side?
Use HttpRequest.is_ajax()
. See the docs.
Some post about django and ajax: Django AJAX Tutorial Part 1 - adding email to newsletter
If you want an easy to use solution for impolementing ajax ni django, I would recommend dajax i am using it in my own project and it simplifies things a lot.
of cause you wont be able to customize it as much as with your own programming but especially for beginners its pretty useful
精彩评论