Tuesday, February 2, 2010

What Is AJAX?

So into this development environment comes a set of technologies that are collectively referred to as AJAX. If you are an “old guy” developer like me, then AJAX represents a similar concept to the client-server development mentioned earlier in the chapter. With client-server development, the amount of data transferred is minimized over a terminal application by transferring only the necessary data back and forth. Similarly, with AJAX, only the necessary data is transferred back and forth between the client and the web server. This minimizes the network utilization and processing on the client.

Advantages of AJAX

The advantages of AJAX over classical web-based applications include:
  • Asynchronous calls — AJAX allows for the ability to make asynchronous calls to a web server. This allows the client browser to avoid waiting for all data to arrive before allowing the user to act once more.
  • Minimal data transfer — By not performing a full postback and sending all form data to the server, network utilization is minimized and quicker operations occur. In sites and locations with restricted pipes for data transfer, this can greatly improve network performance.
  • Limited processing on the server — Along with the fact that only the necessary data is sent to the server, the server is not required to process all form elements. By sending only the necessary data, there is limited processing on the server. There is no need to process all form elements, process the ViewState, send images back to the client, or send a full page back to the client.
  • Responsiveness—Because AJAX applications are asynchronous on the client, they are perceived to be very responsive.
  • Context — With a full postback, users may lose the context of where they are. Users may be at the bottom of a page, hit the Submit button, and be redirected back to the top of the page. With AJAX there is no full postback. Clicking the Submit button in an application that uses AJAX will allow users to maintain their location. The user state is maintained, and the users are no longer required to scroll down to the location they were at before clicking Submit.

History of AJAX

For all its perceived newness and sexiness, the technologies that make up AJAX are really not new. The ability to communicate back to the server through a hidden frame without posting the main page back to the server has been around for a long time. Communication between client and server has been available— back to the release of Internet Explorer’s ability to script ActiveX controls on the client browser and to the MSXML component, both of which date back into the late 1990s. Personally, I saw the first formal usage of client script and MSXML in 2003. The problem with the technology at that time was the need to manually create the necessary client-side JavaScript. In 2003, there was too much code overall that had to be written and too much custom code that had to be written to get this to work. Only since the second half of 2005 have client-side libraries and server-side support for ASP.NET started to make their presence felt and been used significantly. 
 The mainstream development community has only recently started using the technique. The release of Google’s Suggest and Maps are what really opened the eyes of the users to the development technologies. These applications sent a shockwave through the development community. 

0 Comments: