AJAX

Daniel Walz
Mar 31 · 2 min read

In the tech world you hear terms thrown around so casually, and since the tech world is a giant place, that can be a lot of terms. A lot of times you just nod your head to these terms so that you don’t look stupid amongst your peers but then realized you really don’t know what they are referring to. AJAX has been one of those things for me. I have used AJAX concepts without realizing it many times.

AJAX stands for Asynchronous JavaScript and XML. So what is Asynchronous. Asynchronous actions in programming is referring to how the code is processed. Typically code is done synchronously in which it executes line by line waiting for the line before to fully execute before the next line of code is executed. Its predictable and more efficient however Asynchronous is needed when code that is being executed is unknown when it will fully executed. An example of this is when a user on the client side is requesting information from an API, a database, etc. Since the client side is waiting for the response and doesn’t know how long or even if it will receive an answer back, it would be better for the Javascript, HTML and CSS that the client does have to go ahead and render this info first instead of waiting for an undetermined amount of time.

There are many AJAX libraries that essentially do the same thing that can be added into Javascript to perform Asynchronous actions. The typical one that I have personal experience in is the standard window provided one called Fetch. The Fetch function takes a URL along with one of the many HTTP Restful verb (get by default, delete, post, patch, etc). It then returns a promise which is literally the promise of what is to come. That is either the data the server sends back or the error it sends back. After the promise, the rest of the javascript code finishes executing while the server is sending the content requested. Once the content is received, the fetch function goes into the execution stack to finish and will be executed next in its turn within the execution stack.

Further information about AJAX can be found here: https://www.keycdn.com/support/ajax-programming

Daniel Walz

Written by

I am a full stack web developer. I am learning everyday and like to write blog posts to not just inform others but to confirm what I am learning.