Set your Publisher ID in src/config/ads.ts to display live ads.
AJAX Fundamentals & The Asynchronous Web
How background HTTP requests transformed static web pages into fluid web apps
AJAX (Asynchronous JavaScript and XML) allows web pages to be updated asynchronously by exchanging data with a web server behind the scenes without reloading the entire page.
The Paradigm Shift of AJAX
Traditional Web: Every user interaction (form submission, navigation) triggered a full browser page refresh, causing white flashes and resending entire HTML templates.
Modern AJAX Web: JavaScript requests only the specific data payload (JSON) needed, updating the relevant DOM nodes dynamically without interrupting user state.
Despite the "X" (XML) in AJAX, modern applications almost universally transport lightweight JSON payloads.
// Fetching data asynchronously behind the scenes
async function loadUserData(userId) {
const container = document.getElementById("profile");
container.innerHTML = "<p>Loading profile...</p>";
try {
const res = await fetch(`https://api.codexia.org/users/${userId}`);
const user = await res.json();
// Smoothly update UI without reloading the page
container.innerHTML = `<h3>${user.name}</h3><p>${user.email}</p>`;
} catch (err) {
container.innerHTML = "<p class='error'>Failed to load profile.</p>";
}
}Set your Publisher ID in src/config/ads.ts to display live ads.
Test Yourself With Exercise
What is the primary user-experience benefit of AJAX over traditional server-rendered websites?