AJAX

Ramón Saquete

Written by Ramón Saquete

The term AJAX was coined in 2005 by UX designer Jesse James Garrett to describe an asynchronous request technology that was beginning to be used in services such as Google Maps and Gmail. Although ten years earlier, Microsoft had already created this technology under the name of Remote scripting with the first version of the JavaScript object XMLHttpRequest (abbreviated as XHR) in Internet Explorer 5, which was gradually adopted by the other browsers and finally included in the W3C recommendations in 2006.

What is AJAX for?

The intention of this technology is to be able to make asynchronous requests to the server with JavaScript. They are asynchronous because neither the interface nor the execution of JavaScript is blocked once the request is launched. On the contrary, the web continues to run until the response from the server arrives, at which time the code responsible for the request regains control and performs some action with the information obtained.

This action usually consists of updating parts of the page content. In this way, when only a part of the page is updated, an entire reload is avoided, reducing the user’s waiting time and giving a sense of fluidity. The only way to achieve something similar so far was to use iframes and JavaScript, but it was slower because it forced you to load one page inside another.

Why does XML appear in the name?

AJAX is the acronym for Asynchronous JavaScript And XML because, initially, the information returned as a response was in XML format (acronym for eXtended Markup Language). However, this format soon fell into disuse and was replaced by the JSON (JavaScript Object Notation) format, which is much more compact and has a faster transfer of information.

How are AJAX requests made?

AJAX requests are usually made using some form of REST API to pass to the server the information about the requested action, although nowadays it is also very common to use APIs that use Graph QL. This API also allows database queries to be performed in the request itself.

Current status of AJAX technology

The XMLHttpRequest object specification continues to evolve, as can be seen in the WhatWG, currently allowing cross-domain requests, sending binary information, knowing how much has been downloaded to display a loading bar, etc.

There is another API more modern than XMLHttpRequest for making asynchronous requests, called API fetch, so it is common to use indistinctly the expressions AJAX request or fetch request for this type of requests. This new API is easier to use, but at the moment it does not allow you to do as many things as the veteran XMLHttpRequest.

AJAX Request
In Google Chrome developer tools, AJAX requests appear under the XHR tab, where we can see differentiated requests made with the XHR object and the fetch API. We also have the WS tab, to see the requests made with Web Sockets.

Another technology that allows the asynchronous sending of information is Web Sockets, but in this case the communication is bidirectional . So, unlike with XHR or the fetch API, the server can send information to the client, forcing it to update itself, without the client having asked for anything. Although there are ways to implement this capability with XHR, which is known as Comet, AJAX Push or Reverse AJAX.

AJAX is the basis for the operation of SPA (Single Page Application) web applications, where, once the user lands on the application, there is never a full page reload.

If AJAX and especially SPAs are not implemented correctly, indexability problems can arise that will seriously affect SEO.

  •  | 
  • Published on
Ramón Saquete
Ramón Saquete
Web developer and technical SEO consultant at Human Level. Graduated in Computer Engineering and Technical Engineering in Computer Systems. He is also a Technician in Computer Applications Development and later obtained the Pedagogical Aptitude Certification. Expert in WPO and indexability.

What do you think? Leave a comment

Just in case, your email will not be shown ;)

Related Posts

en