Documentation Index

CPAINT :: Cross-Platform Asynchronous INterface Toolkit

What is AJAX?

AJAX is a culmination of existing technologies that allows web developers to provide a new level of interactivity to their applications.

The term AJAX (Asynchronous JavaScript and XML) was coined by Jesse James Garrett in his article entitled "Ajax: A New Approach to Web Applications" (where he also has some graphics to help you visualize how AJAX compares to traditional web applications). However, despite media and blog articles, research shows that the methodology now called AJAX predates Garrett's article. For example, Microsoft introduced the Remote Scripting Toolkit for Internet Explorer 4.0, though it only worked with IE and ASP - and in August 2000, Brent Ashley released his JavaScript Remote Scripting toolkit. The introduction of Maps and Suggest by Google demonstrated that these methodologies were not only useful, but could work across multiple browsers and were within the reach of the smaller developer.

On the client side, AJAX uses the XMLHTTP object (introduced by Microsoft in Internet Explorer 4.0 and subsequently implemented by the Mozilla Foundation in Firefox, AOL in Netscape, and Opera in the Opera Browser) to retrieve an HTML or XML document from the server. JavaScript is used to setup the XMLHTTP object, control it, and update the contents of the web page based on the data retrieved from the server. These operations are completely transparent to the user and can update small sections of a web page (any object, including page divisions, that can be accessed via JavaScript can be manipulated) much faster than submitting a form and reloading the entire page in the browser.

On the server side, AJAX can be as simple or as complex as the developer wants. Basically, the data is passed in and returned the same way as a traditional web application or form. However, additional flags and parameters can be given to call only a single function within a large library or control the content type of the document being returned to the client side. While the "X" in AJAX stands for XML, other content types, such as HTML, JavaScript objects, images, and many other content types can be returned from the server - provided the implementation of JavaScript in the user's browser can handle the payload and manipulation or execution of that data.

Because AJAX "changes" the way we expect a browser to operate, potential applications, methodologies, best practices, and caveats are still being discovered. Though the technologies AJAX build on mature and stable, some older browsers do not have access to the XMLHTTP object and cannot execute web applications utilizing AJAX. Thus, it is in the developer's hands to decide when and where best to implement AJAX and provide a fallback method for communicating with the server.