AJAX
What is Ajax?
If you are thinking about getting information about Ajax FC or the Ajax city, then you've just hit the wrong page. We are here to talk about the term AJAX which stands for Asynchronous JavaScript & XML. The term Ajax was coined in 2005 by James Garrett and is used to describe a combination of technologies of JavaScript, XML, CSS, XHTML and DOM and the all important XHR (XMLHTTPRequest) object. While the name AJAX has only recently been coined, the underlying technologies (JavaScript, XML,
SOAP, and so on) have been maturing for years .XHR was created by Microsoft in IE5 in March of 1999, as an ActiveX Object and it only worked in IE.XHR was then adopted by Mozilla 1.0 and Safari 1.2.And a new generation of web application was born. Its core technique is centered on communication to the server without a page refresh .It is also known as XMLHTTP technique.
Ajax is all about improving the user experience. Since the beginning of then Web, and until recently, the users have nothing to do but fill some forms, click some links and then wait for reloading the whole page. It was not only becoming monotonous but tedious as well. This is what could be called the Web 1.0 model. Google Maps (http://maps.google.com) really ignited the Ajax fire. Google, through the clever use of XHR callbacks provided the first in-page scrollable map. There was no waiting around for a bunch of ads to refresh. It really opened the new pattern of web UI which we prefer to call web 2.0.Real time Live searches, Web based chatting, Dragging and dropping ,instant feedback etc, have really established AJAX as a tool for making richer application. Google gmail, Google suggest, Google maps, Flickr etc. are the examples of Ajax application that have sparked people's imagination.
The four defining principles of Ajax
1. The browser hosts an application, not content
Classically when a user logs into a site, a session is initialized and several serverside objects are created and pages are served to the browser. The home page is dished up to the browser, in a stream of HTML markup that mixes together standard boilerplate presentation and user-specific data. The browser acted as a dumb terminal and flushed whatever was sent to it. But Ajax moves some application logic to the browser. When the user logs in. a more complex document is delivered to the browser, a large proportion of
which is JavaScript. This document will stay with the user throughout the session, although it will probably alter its appearance considerably while the user is interacting with it. It knows how to respond to user input and is able to decide whether to handle the user input itself or to pass a request on to the web server.
2. The server delivers data, not content
As we noted, the classic web app serves up the same mixture of boilerplate, content, and data at every step. An Ajax based application can behave smartly by sending asynchronous requests to the server so that the server can only send back the relevant data while all other features of the page layout are there already.
3 .User interactions with the application can be fluid and continuous
In classic web applications, the only way to contact the server was either to click a hyperlink or to submit a form and wait for the server to respond. But Ajax completely changes this style of communicating the server. With Ajax technology, we can contact the server without interfering the user's flow. Interactions can be made with the server on the basis of mouse drag or movement or on every keystroke as on Google suggest.
4. This is real coding and requires discipline
An Ajax technology doesn't use JavaScript just to get fancy decorations or designs in the site. It really has to do some serious works. In Ajax, the code that you deliver when users launch the application must run until they close it, without breaking.
What can you do with Ajax
The technology for Ajax has been around since 1998, and a handful of applications (such as Microsoft’s Outlook Web Access) have already put it to use. But Ajax didn’t really catch on until early 2005, when a couple of high-profile Web applications (such as Google Suggest and Google Maps) put it to work, and Jesse James Garrett wrote his article coining the term Ajax and so putting everything under one roof. Google has been the pioneer in developing Ajax applications and has done more than nyone to raise the profile of Ajax applications. Some of the applications of Ajax are:
a. Auto complete
This is the Ajax feature that reacts to keystrokes and tries to make intelligent
guesses on what the user is going to type and then suggest it. For example
suggestions in gmail from the address book on typing email addresses.
b. Searching in real time with live searches
This feature gives result to your queries instantly as you enter them.
Googlesuggest is an example of this feature. You can view an example by logging onto http://www.google.com/webhp?complete=1
c. Chatting
Ajax has enabled us to have a web based chat service. http://iloveim.com is an example of a site based on this technology.
d. Dragging and dropping
As you might have seen in many e-commerce sites, you can drag and drop items to your cart which you prefer to buy. This has been made possible by Ajax. Ajax basically deals with the asynchronous handling of events. By using Ajax a rich application can be achieved without any additional plug-ins whatsoever to the browser as Ajax is supported by all major browsers IE, Firefox / Netscape / Mozilla with slight variations. So, Ajax has been a major tool in making the web UI more attractive and user friendly and is definitely here to stay.