It is one of those technologies which rises a great hype, with everyone talking and talking about it.
So, as soon as I've seen its capabilities, I've suddenly got surprised.
How have I encountered it?
A few days ago, as usual, I was working with Cocoon Forms when, testing a form made by my colleague Ugo Cei, I noticed its great responsiveness in combo box dynamic loading and data validation. So, I started browsing the code and while talking with Ugo I've discovered that the high responsiveness was due to AJAX automatic support in Cocoon Forms.
This got my interest, in particular when I discovered that many services like Google Suggest are driven by AJAX.
"Amazing!" I said. "This is great!"
So, how does it work?
I'll do a very short description, because you can find a longer (and better) one in the good articles cited at the end of this post.
Asynchronous means that the client doesn't wait for the server response, and the web page remains responsive. Moreover, the server doesn't send the whole page, but only an XML document containing the information requested by the client, which will be processed by the callback function, updating data without page reloading.
Here is a step-by-step summary:
- This function, called when the user selects some item into the combo box, creates the XMLHttpRequest object which makes an asynchronous request to the server, sending the value of the selected item and then suddenly returning.
- Meanwhile, the server-side code makes some business logic and sends back the data, formatted in an XML document.
- All updates gets suddenly displayed.
What about my previous doubts?
The XMLHttpRequest object, invented by Microsoft (I've always said that Microsoft guys are able to do something good, in particular when working in rooms with windows closed, in order to keep away from noises and bugs), is still not standard, but implemented by all major browsers, from IE to Mozilla. So, interoperability should not be a problem, and if you want to be safe, you can implement a sort of fallback behavior, like Cocoon does.
And the advantages?
You can answer by yourself.
Thanks to AJAX, you gain a more responsive interface, which can make the web a sort of new experience, with new
applications like Google Suggest.
Now the links moment:
And, if Google has AJAX, why should we not?
Try clicking the "In-line view syndication titles ..." link on the bottom of the sidebar...