Andromeda
Note

Ajax Asynchronous Requests

Definition

Asynchronous JavaScript and XML (Ajax) enables pages to request data from the server in the background and update the DOM without a full page reload—modern implementations typically exchange JSON instead of XML.

Why It Matters

Without AJAX, the web would be a series of static, jarring page reloads. It is the technology that made “web applications” (like Gmail or Maps) possible by allowing browsers to talk to servers in the background, creating the fluid, interactive experience we now take for granted.

Core Concepts

  • Asynchronous: Server requests happen without blocking user interaction.
  • Partial Updates: Only changed page regions refresh, not the entire document.
  • JSON: JavaScript Object Notation replaces XML as the standard data format.
// Example of an Ajax request using the Fetch API
fetch('https://api.example.com/data')
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error('Error:', error));
  • Fetch API / XMLHttpRequest: Browser APIs for HTTP requests from JavaScript.
  • Use Cases: Autocomplete, infinite scroll, form validation, SPA data loading.

Connected Concepts