AJAX: The Asynchronous Programming Paradigm, For the Asynchronous Mind

Nick

May 22, 2020

AJAX: The Asynchronous Programming Paradigm, For the Asynchronous Mind.

Coming from a conventional programming background, AJAX was a bit strange to me at first. But trust me, it seems to exist as a handy plugin when it comes to asynchronous and real-time database manipulations. Matter of fact, it happens to be one of the most notable add-ons to the web development toolset, since the rejuvenation of the modern frontend tools. While the existing workaround to data processing within a web app was to filter in all processes into a thread – in a nutshell, synchronous. AJAX came along with an even better approach to handle database operations without waiting in the thread queue by creating its own thread - or some sort of sub-thread to handle its operations.

AJAX simultaneously initiates JavaScript and XML requests which are easier to parse. From this, it reduces website load-time while boosting performance. With AJAX running over the HTTP protocol on its unique thread, it gets access to all the HTTP verbs including the HEAD request. Which allows for data to be seamlessly updated in real-time. Thereby, eradicating the default client-to-server-side synchronous communication that requires a process to be run at regular intervals, and just as the name implies – Asynchronously.


The Invention of The Innovation

Microsoft first introduced the AJAX technology (XMLHttpRequest object) to Internet Explorer in March 1999; as a means of utilizing various web development technologies to register asynchronous web requests and retrieve a response - under the radar, which was highly anticipated. This was at a time when the process of reloading a page every time an update is made (e.g. submitting a form) became exhaustingly boring and unartistic to the entire web development community. Hence, AJAX - which stands for Asynchronous JavaScript and XML as you perhaps know, became an ideal solution just at the right moment. Not long after, other big boys in the tech industry such as; Google, Facebook etc., started to buy into it.  

The Asynchronous Programming Paradigm, For the Asynchronous Mind
Fig1: The Various Components Involved in an AJAX Request

The AJAX Joint Task Force

Evidently, AJAX is not a single technology nor is it a new technology. More so, it is not even a language of its own but rather the fusing of already existing technologies that are exploited in innovative ways. You might call it yet another frontend invention if you may but this technology is more than just an innovation. It is a new way of life for the web. And as earlier mentioned, AJAX achieves its asynchronous functionality by borrowing from a number of web development technologies that includes;


HTMLS and CSS: which is used in combination to mark up and style information.


The DOM: which can be accessed and modified with JavaScript to dynamically display and allow users to interact with the information presented.


The XMLHttpRequest Object & The JavaScript Method: which is primarily employed to execute AJAX on web pages allowing for the asynchronous exchange of data between a browser and a server. This enables contents to be loaded onto the screen without refreshing the page. For this, the XMLHttpRequest (XHR) object is usually used, along with an iFrame, a dynamically added tag or the new JavaScript ‘fetch()’ function -  within a JavaScript code.


Format: of the data sent to the browser is basically JSON and XML, but also include; pre-formatted HTML and plain text. This data can be created dynamically by any server-side scripting language, at which time XSLT can be used for its manipulation.


How Does AJAX Work?

AJAX licenses web applications (and browsers) to send and retrieve data from servers asynchronously – from behind the scenes. With AJAX, browsers and other web application parsers do not need to refresh a page and interfere with the display and behavior of that page every time data is manipulated or updated. By dissociating the presentation layer from the interchange layer, AJAX permits web pages and applications to dynamically alter database contents without the need to reload the entire page.

Apparently, AJAX simplifies things for both software developers and users alike. Since it conveniently eradicates the extra load on servers and dispels the idea of bandwidths being a limiting factor on performance. And believe me when I say this, if you are a web developer reading this, and you happen to have an asynchronous mind – just like I think you do 😊, then AJAX is your ultimate choice!  

On a more personal note, I totally love the idea of asynchronously interacting with a server. Thus, when asked about why I love AJAX so much, I simply say;

‘Assuming you are on Facebook, and you get to like 100 posts (pictures, comments and whatnot). Have you ever Imagined the multitude of times you would have reloaded the page, much less the amount of resources spent while doing so?’

So not cool right?... Boom! There goes the answer. Well, all thanks to JavaScript we don’t have to worry about going through any of that headache.


Nick

Nick

Nick is our Marketing Owner and works from our UK office, he has a wealth of experience in digital & data marketing and is a Certified Scrum Product Owner.