Ajax in Django

56 views
Skip to first unread message

jasir1903

unread,
Aug 31, 2015, 10:00:47 AM8/31/15
to Django users
How to retrive Data from Db in Django to Template using Ajax? I am new to Django i need to retrive the data WITHOUT PAGE REFRESH USING AJAX please help me with that..

Dheerendra Rathor

unread,
Aug 31, 2015, 10:04:45 AM8/31/15
to Django users
Ajax are just normal HTTP requests. You can write a view in your code which returns data from db. If it is a post requests then make sure you're adding "csrfmiddlewaretoken" in the ajax data. 

On Mon, 31 Aug 2015 at 19:30 jasir1903 <jasi...@gmail.com> wrote:
How to retrive Data from Db in Django to Template using Ajax? I am new to Django i need to retrive the data WITHOUT PAGE REFRESH USING AJAX please help me with that..

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c4c35ccb-ed72-4850-87f5-730310f37883%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Martin Torre Castro

unread,
Sep 19, 2015, 4:19:08 AM9/19/15
to Django users
If you use jQuery (I do), making AJAX requests is incredibly easy. Just use the $.get(), $.post() or $.ajax() functions.

If you have any doubt, the api.jquery.com page has all the references and information for using them (search for jQuery.get(), jQuery.post() and jQuery.ajax() ).
Reply all
Reply to author
Forward
0 new messages