Xiao Liang
Xiao Liang

Reputation: 773

Jquery's Ajax or Dajax for a django project?

I want to use AJAX in a django website. As far as I know, I can do that via JQuery API, such as $.ajax() and .load(). But I also recognized that there is a very popular 3rd party plug-in for django called Dajax.

So what are the pros and cons for using JQuery Ajax and Dajax respectively?

One thing I found is that when using JQuery Ajax in Django, you should config a url for each Ajax request. The Ajax request will find a python function in your views.py file via this url.

But when using Dajax, you don't need to do so. It seems you can call a python function (directly from your template) in the ajax.py file under project's app directory without config a specific url for it.

I'm not even sure wether this difference I mentioned above is true. This question seems silly. But I'm new to both Django and Ajax concepts. I did some search but the Dajax seems to be poorly documented. So I can not figure it out.

Can anyone help me? Thanks a lot.

Upvotes: 1

Views: 798

Answers (1)

mccc
mccc

Reputation: 2454

I enjoyed using Dajax, some years ago, but now, as the nice Jorge Bastida himself says in the project page, the need is much thinner and using both technologies without any middle layer works just fine.

If you worry about having to write too many views for the dynamic part of your app, just go for a bigger one that behaves differently according to the parameters passed with the ajax call - I'm doing it often on a v1.7 project and, together with the new JsonResponse, everything goest smoothly.

Upvotes: 1

Related Questions