Thursday, March 8, 2007

AJAX

I started looking into AJAX. We want to use AJAX for doing searches for client.

Turns out it is much simpler than I thought, at least if you have worked with asynchronous programming, callbacks and closures before. First thing to note is that it's a good idea to use a library to do most of the Javascript stuff because of browser incompatibilities. I digged up jQuery which seems sensible. I suggest starting with this tutorial from the documentation page.

There's really not much more in it than a few lines of simple Javascript code (because of the library) on the client side. You register a callback and can inject things into the page when you get data. On the server-side is a standard PHP/Django/ASP/whatever script that parses GET or POST parameters and returns an XML string. It's even simpler than normal form processing because you just return the data you need on the client side instead of a whole page.

There are also a couple of links to tutorials on the Wikipedia page on AJAX to understand what jQuery is doing under the hood.

No comments:

Post a Comment