XMLHttpRequest object. Despite the name, the use of XML is not required (JSON is often used instead), and the requests do not need to be asynchronous.
In the 1990s, most web sites were based on complete HTML pages. Each user action required that the page be reloaded from the server (or a new page loaded). This process was inefficient, as reflected by the user experience: all page content disappeared then reappeared. Each time a page was reloaded due to a partial change, all of the content had to be re-sent, even though only some of the information had changed. This placed additional load on the server and used excessive bandwidth.
In 1998, Microsoft Outlook Web Access team implemented the first component XMLHTTP by client script.
The term Ajax has come to represent a broad group of web technologies that can be used to implement a web application that communicates with a server in the background, without interfering with the current state of the page. In the article that coined the term Ajax, Jesse James Garrett explained that the following technologies are incorporated:
- HTML (or XHTML) and CSS for presentation
- The Document Object Model (DOM) for dynamic display of and interaction with data
- XML for the interchange of data, and XSLT for its manipulation
- The XMLHttpRequest object for asynchronous communication
Asynchronous HTML and HTTP (AHAH) involves using XMLHTTPRequest to retrieve (X)HTML fragments which are then inserted directly into the web page.
- In pre-HTML5 browsers, pages dynamically created using successive Ajax requests did not automatically register themselves with the browser's history engine, so clicking the browser's "back" button may not have returned the browser to an earlier state of the Ajax-enabled page, but may have instead returned to the last full page visited before it. Such behavior — navigating between pages instead of navigating between page states — may be desirable, but if fine-grained tracking of page state is required then a pre-HTML5 workaround was to use invisible iframes to trigger changes in the browser's history. A workaround implemented by Ajax techniques is to change the URL fragment identifier (the part of a URL after the '#') when an Ajax-enabled page is accessed and monitor it for changes. HTML5 provides an extensive API standard for working with the browser's history engine.
- Dynamic web page updates also make it difficult to bookmark and return to a particular state of the application. Solutions to this problem exist, many of which again use the URL fragment identifier. The solution provided by HTML5 for the above problem also applies for this.
- Depending on the nature of the Ajax application, dynamic page updates may interfere disruptively with user interactions, especially if working on an unstable Internet connection. For instance, editing a search field may trigger a query to the server for search completions, but the user may not know that a search completion popup is forthcoming, and if the internet connection is slow, the popup list may show up at an inconvenient time, when the user has already proceeded to do something else.
- Similarly, some web applications which use Ajax are built in a way that cannot be read by screen-reading technologies, such as JAWS. The WAI-ARIA standards provide a way to provide hints in such a case.
- Screen readers that are able to use Ajax may still not be able to properly read the dynamically generated content.
- The same origin policy prevents some Ajax techniques from being used across domains, although the W3C has a draft of the XMLHttpRequest object that would enable this functionality. Methods exist to sidestep this security feature by using a special Cross Domain Communications channel embedded as an iframe within a page, or by the use of JSONP.
- The asynchronous callback-style of programming required can lead to complex code that is hard to maintain, to debug and to test.
See also 
- Ajax framework
- List of Ajax frameworks
- AJAX Service Bus
- Comet (programming) (also known as Reverse Ajax)
- Rich Internet application
- Jesse James Garrett (18 February 2005). "Ajax: A New Approach to Web Applications". AdaptivePath.com. Retrieved 19 June 2008.
- Ullman, Chris (March 2007). Beginning Ajax. wrox. ISBN 978-0-470-10675-4. Archived from the original on 5 July 2008. Retrieved 24 June 2008.
- "Dynamic HTML and XML: The XMLHttpRequest Object". Apple Inc. Retrieved 25 June 2008.
- Hopmann, Alex. "Story of XMLHTTP". Alex Hopmann’s Blog. Retrieved 17 May 2010.
- "A Brief History of Ajax". Aaron Swartz. 22 December 2005. Retrieved 4 August 2009.
- "Speed Up Your Ajax-based Apps with JSON". DevX.com. Archived from the original on 4 July 2008. Retrieved 4 July 2008.
- "Why use Ajax?". InterAKT. 10 November 2005. Archived from the original on 29 May 2008. Retrieved 26 June 2008.
- "Deep Linking for AJAX".
- "HTML5 specification". Retrieved 21 October 2011.
- Prokoph, Andreas (8 May 2007). "Help Web crawlers efficiently crawl your portal sites and Web sites". IBM. Retrieved 22 April 2009.
- Quinsey, Peter. "User-proofing Ajax".
- "WAI-ARIA Overview". http://www.w3.org/. Archived from the original on 26 October 2010. Retrieved 21 October 2010.
- Edwards, James (5 May 2006). "Ajax and Screenreaders: When Can it Work?". sitepoint.com. Retrieved 27 June 2008.
- "Access Control for Cross-Site Requests". World Wide Web Consortium. Archived from the original on 14 May 2008. Retrieved 27 June 2008.
- "Secure Cross-Domain Communication in the Browser". The Architecture Journal (MSDN). Archived from the original on 29 March 2010. Retrieved 27 April 2010.
- Cuthbertson, Tim. "What is asynchronous programming, and why is it so damn awkward?". http://gfxmonk.net/. Retrieved 19 October 2010.
- "Selenium documentation: Fetching a Page". http://seleniumhq.org/. Retrieved 6 October 2011. "It’s worth noting that if your page uses a lot of AJAX on load then WebDriver may not know when it has completely loaded. If you need to ensure such pages are fully loaded, then you can use an Explicit and Implicit Waits."
|Wikimedia Commons has media related to: AJAX (programming)|
|Wikibooks has a book on the topic of: AJAX|
- Ajax: A New Approach to Web Applications—Article that coined the term and Q&A
- Ajax (programming) at the Open Directory Project
- Ajax Tutorial with GET, POST, text and XML examples.