From Wikipedia, the free encyclopedia
(Redirected from AJAX)
The Ajax technique uses a combination of:
- XHTML (or HTML) and CSS, for marking up and styling information.
- The XMLHttpRequest object is used to exchange data asynchronously with the web server. In some Ajax frameworks and in certain situations, an IFrame object is used instead of the XMLHttpRequest object to exchange data with the web server, and in other implementations, dynamically added <script> tags may be used.
- XML is sometimes used as the format for transferring data between the server and client, although any format will work, including preformatted HTML, plain text, JSON and even EBML. These files may be created dynamically by some form of server-side scripting.
The first use of the term in public was by Jesse James Garrett in February 2005. Garrett thought of the term when he realised the need for a shorthand term to represent the suite of technologies he was proposing to a client.
Although the term “Ajax” was coined in 2005, most histories of the technologies that enable Ajax start a decade earlier with Microsoft‘s initiatives in developing Remote Scripting. Techniques for the asynchronous loading of content on an existing Web page without requiring a full reload date back as far as the IFRAME element type (introduced in Internet Explorer 3 in 1996) and the LAYER element type (introduced in Netscape 4 in 1997, abandoned during early development of Mozilla). Both element types had a
The Web development community, first collaborating via the microsoft.public.scripting.remote newsgroup and later through blog aggregation, subsequently developed a range of techniques for remote scripting in order to enable consistent results across different browsers. In 2002, a user-community modification to Microsoft Remote Scripting was made to replace the Java applet with XMLHttpRequest.
David W. Radcliffe demonstrated an un-named technique  using a VB6-created ActiveX control rendering the entire Web Page content for a re-work  of his employer’s poorly-performing Web-based CRM system at the end of 2003. This control asyncronously pulled all the data required to be displayed after the page itself (containing only one ActiveX control) had been loaded, avoiding page re-loads to display new or updated data elements. It also avoided page re-loads when presentation elements (drop-downs, labels, etc.) needed to be be changed in response to some other element changing or being selected.
In addition, the World Wide Web Consortium has several Recommendations that also allow for dynamic communication between a server and user agent, though few of them are well supported. These would include:
- The object element defined in HTML 4 for embedding arbitrary content types into documents, (replaces inline frames under XHTML 1.1)
- The Document Object Model (DOM) Level 3 Load and Save Specification 
The core justification for Ajax style programming is to overcome the page loading requirements of HTML/HTTP-mediated web pages. Ajax creates the necessary initial conditions for the evolution of complex, intuitive, dynamic, data-centric user interfaces in web pages – the realization of that goal is still a work in progress.
Web pages, unlike native applications, are loosely coupled, meaning that the data they display are not tightly bound to data sources and must be first marshalled into an HTML page format before they can be presented to a user agent on the client machine. For this reason, web pages have to be re-loaded each time a user needs to view different datasets. By using the XmlHttpRequest object to request and return data without a re-load, a programmer by-passes this requirement and makes the loosely coupled web page behave much like a tightly coupled application, but with a more variable lag time for the data to pass through a longer “wire” to the remote web browser.
For example, in a classic desktop application, a programmer has the choice of populating a tree view control with all the data needed when the form initially loads, or with just the top-most level of data – which would load quicker, especially when the dataset is very large. In the second case, the application would fetch additional data into the tree control depending on which item the user selects. This functionality is difficult to achieve in a web page without Ajax. To update the tree based on a user’s selection would require the entire page to re-load, leading to a very jerky, non-intuitive feel for the web user who is browsing the data in the tree.
 Pros and cons
 Bandwidth utilization
In addition to “load on demand” of contents, some web based applications load stubs of event handlers and then load the functions on the fly. This technique significantly cuts down the bandwidth consumption for web applications that have complex logic and functionality.
 User interface
The most obvious reason for using Ajax is an improvement to the user experience. Pages using Ajax behave more like a standalone application than a typical web page. Clicking on links that cause the entire page to refresh feels like a “heavy” operation. With Ajax, the page often can be updated dynamically, allowing a faster response to the user’s interaction. While the full potential of Ajax has yet to be determined, some believe it will prove to be an important technology, helping make the web even more interactive and popular than it currently is.
 Separation of Data, Format, Style, and Function
 Browser integration
The dynamically created page does not register itself with the browser history engine, so triggering the “Back” function of the users’ browser might not bring the desired result.
Developers have implemented various solutions to this problem. These solutions can involve using invisible IFRAMEs to invoke changes that populate the history used by a browser’s back button. Google Maps, for example, performs searches in an invisible IFRAME and then pulls results back into an element on the visible web page. The World Wide Web Consortium (W3C) did not include an iframe element in its XHTML 1.1 Recommendation; the Consortium recommends the object element instead.
 Response-time concerns
Network latency — or the interval between user request and server response — needs to be considered carefully during Ajax development. Without clear feedback to the user , smart preloading of data and proper handling of the XMLHttpRequest object, users might experience delay in the interface of the web application, something which users might not expect or understand. Additionally, when an entire page is rendered there is a brief moment of re-adjustment for the eye when the content changes. The lack of this re-adjustment with smaller portions of the screen changing makes the latency more apparent. The use of visual feedback (such as throbbers) to alert the user of background activity and/or preloading of content and data are often suggested solutions to these latency issues.
Microsoft’s Ajax Extensions addresses this network latency issue by offering the UpdateProgress control which allows the developer to alert the user that the page is being updated.
 Search Engine Optimization
Using Ajax technologies in web applications provides many challenges for developers interested in adhering to WAI accessibility guidelines. In addition there are numerous development groups working on USA government projects which require strict adherence to Section 508 Compliance standards. Failure to comply with these standards can often lead to cancellation of contracts or lawsuits intended to ensure compliance.
Because of this, developers need to provide fallback options for users on other platforms or browsers, as most methods of Ajax implementation rely on features only present in desktop graphical browsers.
Web developers use Ajax in some instances to provide content only to specific portions of a web page, allowing data manipulation without incurring the cost of re-rendering the entire page in the web browser. Non-Ajax users would ideally continue to load and manipulate the whole page as a fallback, allowing the developers to preserve the experience of users in non-Ajax environments (including all relevant accessibility concerns) while giving those with capable browsers a much more responsive experience.
 See also
- Ajax framework
- Comet (programming)
- HTTP streaming
- Progressive enhancement
- Reverse Ajax
- Rich Internet application
- Single page application
- Web 2.0
- ^ Ajax: A New Approach to Web Applications. Adaptive Path (2005-02-18). Retrieved on 2006–08-01.
- ^ At subsequent talks and seminars Garrett has made the point that Ajax is not an acronym.
- ^ HTTPRequest-enabled RS. microsoft.public.scripting.remote newsgroup (2002-06-18). Retrieved on 2006–08-01.
- ^ ARSCIF: A Framework for Asynchronous Remote–Script Callback Invocation. Sebastiano Vigna. Retrieved on 2006–08-01.
- ^ Cutting Edge: Script Callbacks in ASP.NET. MSDN Magazine (2004-08-08). Retrieved on 2006–08-01.
- ^ Asynchronous data retrieval for web pages – Demo code. David William Radcliffe. Retrieved on 2003–11-12.
- ^ Re-work of Web Based CRM System (.ppt). David William Radcliffe. Retrieved on 2003–11-12.
- ^ Uniform Resource Identifiers (URI): Generic Syntax. The Internet Society (August 1998). Retrieved on 2006–07-21.
- ^ Uniform Resource Identifier (URI): Generic Syntax. The Internet Society (January 2005). Retrieved on 2006–07-21.
- ^ Remote Scripting with AJAX, Part 2. O’Reilly XML.com (2005-08-22). Retrieved on 2006–07-21.