Writing the server side of an AJAXy search was pretty straightforward. In your view function, Instead of rendering a template, you call json.dumps() (or the equivalent in XML), and set the content type of the HTTP response (i think "application/json"). Django won't generate your client side JavaScript for you (nor should it IMO), so use jQuery or whatever you want.
good point! django doesnt have any built in http resposnes or decorators for returning json (as far as i know anyways). I would recommend looking at these two options:
Many web apps/services now use at least a little AJAX. Certain things in a framework can make it easier. Some discussion of how AJAX techniques, up through 'single-page apps', can use a DJango back-end would be nice. (Maybe not absolutely necessary... but nice.)
AJAX is nothing more than sending and receiving data from the server to the client. That's what views do, and they are documented.
There is also an is_ajax() test in Django (not that useful) and various apps that provide REST interfaces that you'd probably want to use for bigger AJAX-y apps.
dmoney|13 years ago
misiti3780|13 years ago
https://github.com/clutchio/clutch/blob/master/django_ext/ht...
https://github.com/samuelclay/NewsBlur/blob/master/utils/jso...
iends|13 years ago
gojomo|13 years ago
nkuttler|13 years ago
There is also an is_ajax() test in Django (not that useful) and various apps that provide REST interfaces that you'd probably want to use for bigger AJAX-y apps.
devniel|13 years ago