Tuesday, February 14, 2006

AJAX vs Classical Web Application

Classsical Web Application Model

Thw working of a classical web application can be summurized as this : An user action triggers a HTTP Request back to the web server. The server does the needed processing and returns an HTML page back to the client.

This approach is simple and makes sense. But there is a serious drawback.When the webserver is busy doing the processing, what is user doing ? User cannt do anything other than waiting for the Server response.




AJAX Model

AJAX model works in a slightly different way.It introduces a intermediate layer, known as the AJAX engine, between the user and the web server.

So when normal page would result in a HTTP request, an AJAX implementation would result in a javascript call to the AJAX engine. Any user response, that doesnt need a trip to server like simple validation are done by the engine without going to the web server. However if the engine needs to interact with server, then it does so using asynchronous request without stalling the user interaction with the page.

Usually the data retrivals are made using XMLHttpRequest object.

This makes the an AJAX implemented page much faster to user interactions. However the technology is still in development stages and need to improve a lot.

Some of the best implemention of AJAX is the Google Suggest, Gmail etc.