Question:

What is AJAX?

AJAX stands for Asynchronous JavaScript And XML.

AJAX is a technique that allows web pages to update parts of themselves without reloading the entire page. Before AJAX, if you wanted to load new data from the server, you had to refresh the whole page.

This was a huge deal when it emerged in the mid-2000s. Google Maps was one of the most famous early examples. You could drag the map around and it would load new map tiles in the background without disrupting what you were doing. Gmail let you read and send emails without ever leaving the page. This was the beginning of Web 2.0.

Here’s how it works. JavaScript running in your browser makes a request to the server in the background (that’s the “asynchronous” part). The server sends back data, and then JavaScript updates just the part of the page that needs to change. The user never sees a page refresh or loading screen.

Despite having “XML” in the name, most modern applications use JSON instead of XML for the data format. JSON is simpler and works more naturally with JavaScript. But the name AJAX stuck.

AJAX is the foundation that made Single Page Applications (SPAs) possible. Modern frameworks like React, Vue, and Angular all rely heavily on AJAX to fetch data and update the page without reloading.

You might also hear the term “fetch” or “fetch API” which is the modern JavaScript API for making AJAX requests. The older approach used something called XMLHttpRequest, but fetch is now the standard way.

See also What is a SPA?

You might also like