Skip to content

Working with AJAX

AJAX (Asynchronous JavaScript and XML) is a web development technique that allows web applications to send and retrieve data from a server asynchronously without reloading the entire page. Only the relevant parts of the page are updated, making interactions faster and smoother.

AJAX is not a programming language but a concept that combines several technologies: JavaScript, the Fetch API (or the older XMLHttpRequest), HTML/CSS, and data exchange formats like JSON.


  1. Triggering event: The user interacts with the page (clicking a button, typing in a search field, scrolling, etc.).
  2. AJAX request: JavaScript sends an HTTP request to the server asynchronously using the Fetch API.
  3. Server processing: The server processes the request and sends back a response (typically JSON).
  4. Page update: JavaScript receives the response and updates the relevant part of the page via DOM manipulation.

Example — search without page reload:

  1. You type a search query and click “Search.”
  2. JavaScript sends the search term to the server via AJAX.
  3. The server returns results in JSON format.
  4. JavaScript updates the page to display the results — no reload needed.

  • Live search: Search suggestions that appear as you type.
  • Form validation: Real-time checking (email availability, password strength).
  • Chat applications: Sending and receiving messages without page refresh.
  • Social media feeds: Infinite scrolling and live-updating content.
  • Real-time dashboards: Weather apps, maps, and live data displays.