I have a very simple test with jQuery and a django view:
HTML – Includes jQuery.js
JavaScript – $(document).ready( $.get("/index/" ); )
Django urls.py:
(r'^index/', index_view ),
Django views.py:
def index_view(request): if request.GET: return HttpResponse( "RECEIVED GET" )
Debugging in browser, the javascript gets called but the view never displays “RECEIVED GET”.
First, you want to anonymous function here, like this:
Then, this only gets the response, it doesn’t do anything with it, if you want to do something with the content, do it in the callback, like this: