The Web Developer Bootcamp 2024

Colt Steele

Back to Ajax Index Page


Ajax Introduction

What is Ajax

AJAX is an acronym for Asynchronous JavaScript And XML. AJAX is not a programming language. It is a web development technique in which a web app fetches new content from a server, by making asynchronous HTTP requests. It then uses the new content to update the relevant parts of the page without requiring a full page load. This can make the page more responsive, because only the parts that need to be updated are requested.

AJAX has been called a developer's dream, because you can:

  • - Read data from a web server - after the page has loaded.
  • - Update a web page without reloading the page.
  • - Send data to a web server - in the background.
AJAX is a bit of a misleading name. AJAX applications might use XML to transport data, but it is equally common to transport data as plain text or JSON text.


How AJAX Works:

  • 1). An event occurs in a web page (the page is loaded, a button is clicked)
  • 2). An XMLHttpRequest object is created by JavaScript
  • 3). The XMLHttpRequest object sends a request to a web server
  • 4). The server processes the request
  • 5). The server sends a response back to the web page
  • 6). The response is read by JavaScript
  • 7). Proper action (like page update) is performed by JavaScript

  • Fetch API: Modern Browsers can use Fetch API instead of the XMLHttpRequest Object. The Fetch API interface allows web browser to make HTTP requests to web servers. If you use the XMLHttpRequest Object, Fetch can do the same in a simpler way.

Web API's

API stands for Application Programming Interface. An API is actually some kind of interface which has a set of functions. These functions will allow programmers to acquire some specific features or the data of an application. A list of different Web API functions and objects can be found here.

Most communications between a web Page and a web Server work through a Web API. A Web API is an API as the name suggests, that can be accessed over the web using the HTTP protocol.

Web API's work thru endpoints. Endpoints are important aspects of interacting with server-side web APIs, as they specify where resources lie that can be accessed by third party software.

Endpoints need to be static, otherwise the correct functioning of software that interacts with them cannot be guaranteed. If the location of a resource changes (and with it the endpoint) then previously written software will break, as the required resource can no longer be found at the same place. As API providers still want to update their web APIs, many have introduced a versioning system in the URI that points to an endpoint.

Here are a couple of external resources to find free and public apis:

Back to Top