在Django中使用AJAX

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.

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