hi there i am trying a simple example using AJAX, DJANGO, JQUERY, JSON and my if request.is_ajax() is not working for some reason.. here is my code:
URLS: (r'api/newdoc/$', 'rose_miracle.views.newdoc'), VIEW: def newdoc(request): # only process POST request print "entrei" if request.is_ajax(): print "entrei2" _#this is not working data= dict(request.POST) print data # save data to db return HttpResponse(simplejson.dumps([True])) return HttpResponse(simplejson.dumps([False])) js: $(document).ready(function(){ alert("ya"); $.post("api/newdoc/", function(data) { alert(data); }); } i added this in a file as well, dont know how it works though https://docs.djangoproject.com/en/dev/ref/contrib/csrf/#ajax the print in my request.is_ajax() is now working, what im i doing wrong?? -- You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/J9sGcOB5wBwJ. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.