What really is AJAX

Hello,
I am new to Javascript, and I was just wondering if AJAX is the same as asynchronous JavaScript.

AJAX stands “Asynchronous Javascript And XML”, typically used to request data and then act upon that data asynchronously (i.e. not halting the rest of the code from running until the AJAX request receives a response). Hopefully that answers your question.

Ajax is a technique used on web pages/web apps to get data from a server and display it on the page, normally without blocking everything on the page from working while you wait for the data.

If it is done without blocking, then by definition it is asynchronous.

It isn’t the same thing as asynchronous JS: AJAX is one technique that makes use of the asynchronous features of JS. AJAX can be asynchronous, but not all asynchronous things are AJAX. What you are saying is like saying chips are the same as food: they aren’t, they’re just one type of food.

any action a user takes that has some JS attached to it may make use of async features, not just getting data from a server (for example, clicking a button which triggers something happening somewhere else on the page).

2 Likes

yes it is not so different

AJAX is a rather outdated term and should really be put out to grass. A more useful term is HTTP request. HTTP is a set of standards for transferring data across the internet. That data can be transferred in many different formats (MIME types) such as JSON (JavaScript object notation), HTML and plain text. XML is an older data format which looks like HTML.

HTTP requests take a certain amount of time to return data. Because of this, they are handled by asynchronous methods which prevent the blocking of code execution. Asynchronous code allows the program to continue, but defines a callback function which gets called when the data returns. There are several different ways to handle this type of code: with callbacks, with promises, and now with async / await.

2 Likes