jquery - Django: How do I go about changing my simple app to use Ajax? -
I currently have a web page where the user records some data and then clicks the submit button. I process the data in views.py and then use the same DjCo template to return the original data and results. What I would like to do, it tries to feel a modern look and feel. You know as a thing, the page does not refresh, but the spinning disk displays until the results show up. I mean using Ajax? How difficult is it to use Ajax to modify a simple app like this? what does that involve? What are the best tools to use? JQuery?
You just need to use AJAX
Example:
$ ('# form'). Bind ('submit', function () {$ .ajax ({url: $ (this) .attr ('action'), type: "post", data: {// form input}, success: function ) {// Code for updating DOM}}}) Return Return;});
This prevents the form from being reloaded using AJAX.
I would advise you to take a look, there is a clear explanation for Ajax handling in this:
Comments
Post a Comment