AJAX explained

AJAX (Asynchronous JavaScript and XML), or Ajax, is a web development technique used for creating interactive web applications. The intent is to make web pages feel more responsive by exchanging small amounts of data with the server behind the scenes so that the entire web page does not have to be reloaded each time the user requests a change. This is intended to increase the web page's interactivity, speed, functionality, and usability.

AJAX is asynchronous in that extra data is requested from the server and loaded in the background without interfering with the display and behaviour of the existing page. JavaScript is the scripting language in which AJAX function calls are usually made.Because of the varying uses of JavaScript and related variant languages. It is commonly identified as both a programming language and a scripting language. Data is retrieved using the XMLHttpRequest object that is available to scripting languages run in modern browsers. There is, however, no requirement that the asynchronous content be formatted in XML.

AJAX is a cross-platform technique usable on many different operating systems, computer architectures, and web browsers as it is based on open standards such as JavaScript and the DOM. There are free and open source implementations of suitable frameworks and libraries.

Constituent technologies

AJAX uses a combination of:
  • XHTML (or HTML) and CSS, for marking up and styling information.
  • The DOM accessed with a client-side scripting language, especially ECMAScript implementations such as JavaScript and JScript, to dynamically display and interact with the information presented.
  • 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 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 and JSON. These files may be created dynamically by some form of server-side scripting.
Like DHTML, LAMP, and SPA, Ajax is not a technology in itself, but a term that refers to the use of a group of technologies.

The "core" and defining element of Ajax is the XMLHttpRequest object, which gives browsers the ability to make dynamic and asynchronous data requests without having to reload a page, eliminating the need for page refreshes.

Besides XMLHttpRequest, the use of DOM, CSS, and JavaScript provides a more-enhanced "single-page" experience.


The first use of the term in public was by Jesse James Garrett in February 2005. Garrett thought of the term when he realized 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 of the technologies that enable Ajax started a decade earlier with Microsoft's initiatives in developing Remote Scripting. Referring to the idea as Inner-Browsing, Netscape Evangelism published an article in 2003 which presented ideas for implementing models in which "all navigation occurs within a single page, as in a typical application interface."

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 src attribute that could take any external URL, and by loading a page containing JavaScript that manipulated the parent page, Ajax-like effects could be attained. This set of client-side technologies was usually grouped together under the generic term of DHTML. Macromedia's Flash could also, from version 4, load XML and CSV files from a remote server without requiring a browser to be refreshed.

Microsoft's Remote Scripting (MSRS), introduced in 1998, acted as a more elegant replacement for these techniques, with data being pulled in by a Java applet with which the client side could communicate using JavaScript. This technique worked on both Internet Explorer version 4 and Netscape Navigator version 4 onwards. Microsoft then created the XMLHttpRequest object in Internet Explorer version 5 and first took advantage of these techniques using XMLHttpRequest in Outlook Web Access supplied with the Microsoft Exchange Server 2000 release.

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 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.

Remote Scripting Frameworks such as ARSCIF surfaced in 2003 not long before Microsoft introduced Callbacks in ASP.NET.

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 marshaled (set out in proper order) 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 bypasses 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 more quickly, 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.


Some uses for Ajax interactions are the following:

  • Real-time form data validation: Form data such as user IDs, serial numbers, postal codes, or even special coupon codes that require server-side validation can be validated in a form before the user submits a form. See Realtime Form Validation for details.
  • Autocompletion: A specific portion of form data such as an email address, name, or city name may be autocompleted as the user types.
  • Load on demand: Based on a client event, an HTML page can fetch more data in the background, allowing the browser to load pages more quickly.
  • Sophisticated user interface controls and effects: Controls such as trees, menus, data tables, rich text editors, calendars, and progress bars allow for better user interaction and interaction with HTML pages, generally without requiring the user to reload the page.
  • Refreshing data and server push: HTML pages may poll data from a server for up-to-date data such as scores, stock quotes, weather, or application-specific data. A client may use Ajax techniques to get a set of current data without reloading a full page. Polling is not the most efficient means of ensuring that data on a page is the most current. Emerging techniques such as Comet are being developed to provide true server-side push over HTTP by keeping a persistent connection between the client and server.
  • Partial submit: An HTML page can submit form data as needed without requiring a full page refresh.
  • Mashups: An HTML page can obtain data using a server-side proxy or by including an external script to mix external data with your application's or your service's data. For example, you can mix content or data from a third-party application such as Google Maps with your own application.
  • Page as an application: Ajax techniques can be made to create single-page marshaled applications that look and feel much like a desktop application.

Advantages of Ajax

Bandwidth usage

By generating the HTML locally within the browser, and only bringing down JavaScript calls and the actual data, Ajax web pages can appear to load relatively quickly since the payload coming down is much smaller in size, and the rest of the layout does not have to be redrawn on each update. An example of this technique is a large result set where multiple pages of data exist. With Ajax, the HTML of the page (e.g., a table structure with related TD and TR tags) can be produced locally in the browser and not brought down with the first page of the document. 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.

Separation of data, format, style, and function

A less specific benefit of the Ajax approach is that it tends to encourage programmers to clearly separate the methods and formats used for the different aspects of information delivery via the web. Although Ajax can appear to be a jumble of languages and techniques, and programmers are free to adopt and adapt whatever works for them, they are generally propelled by the development motive itself to adopt separation among the following:

  1. Raw data or content to be delivered, which is normally embedded in XML and sometimes derived from a server-side database.
  2. Format or structure of the webpage, which is almost always built in HTML or XHTML and is then reflected and made available to dynamic manipulation in the DOM.
  3. Style elements of the webpage: everything from fonts to picture placement are derived by reference to embedded or referenced CSS.
  4. Functionality of the webpage, which is provided by a combination of:

    1. Javascript on the client browser (Also called DHTML),
    2. Standard HTTP and XMLHttp or client-to-server communication, and
    3. Server-side scripting and/or programs using any suitable language preferred by the programmer to receive the client's specific requests and respond appropriately.


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.

Another issue is that dynamic web page updates make it difficult for a user to bookmark a particular state of the application. Solutions to this problem exist, many of which use the URL fragment identifier (the portion of a URL after the '#') to keep track of, and allow users to return to, the application in a given state. This is possible because many browsers allow JavaScript to update the fragment identifier of the URL dynamically, so that Ajax applications can maintain it as the user changes the application's state. This solution also improves back-button support. It is not, however, a complete solution.

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 delays in the interface of the web application, something which they 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.

Search engine optimization

Websites that use Ajax to load data which should be indexed by search engines must be careful to provide equivalent Sitemaps data at a public, linked URL that the search engine can read, as search engines do not generally execute the JavaScript code required for Ajax functionality. This problem is not specific to Ajax, as the same issue occurs with sites that provide dynamic data as a full-page refresh in response to, say, a form submit (the general problem is sometimes called the hidden, or deep web).

Reliance on JavaScript

Ajax relies on JavaScript, which is often implemented differently by different browsers or versions of a particular browser. Because of this, sites that use JavaScript may need to be tested in multiple browsers to check for compatibility issues. It's common to see JavaScript code written twice, one part for IE, another part for Mozilla compatibles, although this is less true with the release of IE7 and with the now-common use of JavaScript abstraction libraries like the Prototype JavaScript Framework. Such libraries abstract browser-specific differences from the web developer.

The level of IDE support for JavaScript used to be poor, although it is changing with more wide-spread use of tools like firebug, IE Developer Toolbar and Venkman.

An issue also arises if the user has switched off JavaScript support in the browser, thus disabling the functionality built into the pages.

Web analytics

Many web analytics solutions are based on the paradigm of a new page being loaded whenever new or updated content is displayed to the user, or to track a series of steps in a process such as a check-out. Since Ajax alters this process, care must be taken to account for how to instrument a page or a portion of a page so that it can be accurately tracked. Analytics systems which allow for the tracking of events other than a simple page view, such as the click of a button or link, are the ones most likely to be able to accommodate a site which heavily utilizes Ajax.


Non-Ajax users would ideally continue to load and manipulate the whole page as a fallback, enabling 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. For this reason it is advised to first develop a full application without Ajax, and implement Ajax enhancements as an addition only. The same counts for JavaScript in general, as this can be disabled in most browsers, thereby hindering a user in websites that rely on these technologies.

<-- Previous | Home Glossary | Next -->

📣 Latest tweets mentioning AJAX

📖 Latest blogs mentioning AJAX

nestify.io Icon 🏆 Alexa 40,899 - 📅 - How to build Live Search Box Using PHP, MySQL and AJAX - Want to build a powerful Live search box using PHP, MySQL, and Ajax? If yes! Then this guide will help you explore how to create a powerful live search. Our goal is to provide you with an itemized step-by-step guide so that you can create a Live ...
nestify.io Icon 🏆 Alexa 40,899 - 📅 - File Upload in PHP with jQuery AJAX [2023 Edition] - Discover how to upload files with PHP and jQuery AJAX. Follow our easy guide for a smooth and efficient experience.

xecreators.pk Icon 🏆 Alexa 4,777,198 - 📅 - How to use AJAX in WordPress - Ajax (Asynchronous JavaScript and XML) is a set of web development techniques that allow for the creation of dynamic and interactive web applications. The key feature of Ajax is the ability to update parts of a web page without requiring... The ...
🏆 Alexa 2,040,590 - 📅 - WordPress admin-ajax.php error: The Ultimate Guide on what this is and how to fix it - WordPress is one of the most popular content management systems (CMS) in the world, powering over 40% of all websites on the internet. One of the essential components of WordPress is the admin-ajax.php file, which is responsible for handling Ajax ...
nestify.io Icon 🏆 Alexa 40,899 - 📅 - Indexability in Angular and React with Universal JavaScript - After the appearance of AJAX or, as it is now called, API Fetch, emerge the SPA frameworks (Single Page Application), which through the use of Fetch requests, generate part of the HTML in the client, which prevents the spiders from correctly ...
wpengine.com Icon 🏆 Alexa 2,347 - 📅 - Solving the Cart Fragment Dilemma Once and For All: Introducing Live Cart - WooCommerce Cart Fragments have long presented a dilemma for eCommerce websites. On one hand, Cart Fragments provide needed cart functionality, including the critical “add to cart” action your customers use when selecting an item on your site. On ...
cloudsigma.com Icon 🏆 Alexa 88,105 - 📅 - Installing Webmail Client with Roundcube on Ubuntu 20.04: A Tutorial - Roundcube is an open-source IMAP browser-based email client. It has gained popularity for supporting ACLs and utilizing AJAX (Asynchronous JavaScript and XML) technology. It has excellent features and end-to-end functionalities like email ...

📋 Latest news about AJAX

Full form of AJAX and why do we use it - 📅 - Ajax is not a programming language or a tool, but a concept. Ajax is a client-side script that communicates to and from a server/database without the need for a postback or a complete page refresh. The full form of AJAX is Asynchronous JavaScript And XML. The best definition I’ve read for Ajax is “the method of ...
AtMail Open Update Adds AJAX and Video - 📅 - Linux-based email management appliances and software provider AtMail (www.atmail.com) has launched AtMail Open 1.03, the latest version of its open-source webmail platform. AtMail Open's latest update follows the company's December announcement that AtMail Open would be available through Parallels' ...
Light, AJAX and PDF Invoices Cement SplendidCRM as the Ideal CRM Platform - 📅 - RALEIGH, N.C. --(BUSINESS WIRE)-- SplendidCRM Software, Inc., a pioneering provider of Microsoft-centric Customer Relationship Management (CRM) solutions for open-source use, today announced the launch of Version 2.1 of its flagship platform SplendidCRM. The new Silverlight graphs provide SplendidCRM developers with ...
SQLFusion Unveils Ajax Site Builder - 📅 - SQLFusion (sqlfusion.com) announced on Thursday that it had released an updated version of its Drag Drop Site Creator (dragdropsitecreator.com), built using Ajax technology. Drag Drop Site Creator is designed primarily for Web hosting companies, which offer it as a service to customers. ...
Outblaze Unveils AJAX Webmail - 📅 - Hosted email solutions provider Outblaze (outblaze.com) recently announced the release of its new AJAX-based webmail service, Outblaze AJAX Webmail. The new service delivers a desktop-like email experience via the Web for ISPs, registrars, Web hosts, educational institutions and other tech-based ...
CrystalTech Offers ASP.NET AJAX 1.0 - 📅 - CrystalTech Web Hosting (crystaltech.com) announced on Thursday it now offers support for ASP.NET AJAX 1.0 on all of its ASP.NET 2.0 shared hosting plans. ASP.NET AJAX 1.0, formerly known as "Atlas", allows programmers to quickly create more efficient and interactive Web content that is compatible with popular ...
Applied Inn. Offers ASP.NET AJAX - 📅 - Web hosting provider Applied Innovations (appliedi.net) announced on Thursday it is now offering support for ASP.NET AJAX hosting, formerly referred to as ASP.NET Atlas. Developed by Microsoft, ASP.NET AJAX enables developers to quickly and efficiently create customized, interactive Web experiences. ...