In order to understand what Asynchronous JavaScript is, we need to first know what synchronous JavaScript means.
Every JS function or code runs in a certain rule of sequence. For example, in order to execute a multi-line code, a first set of instructions is executed just to go to the next step and the next, and then the final execution to get to the result. It simply means that the code is executed line by line as per the programmer defines the code. So, its sequential.
Now, problem arises when any one of the lines of code from the matrix takes a longer time to run and the other functions need to wait. So, it blocks the other individual pieces of codes from executing in those cases.
That’s exactly where the Asynchronous JS comes to the rescue. So what asynchronous code does is that it gets the code out of the way of other pieces of functions and makes it run in the background so that it does not interfere with the smooth functioning of other codes.
Hence Asynchronous code (which can be a callback function or whatever) is a code which can happen in the background while the rest of the code executes smoothly. Its non-intrusive. to other individual pieces of codes. Here an action is differed to the future so that it does not block any other codes.
AJAX stands for Asynchronous JavaScript and XML. AJAX is an in-built object that allows us to request data from a web server dynamically in an asynchronous way. For example you can make AJAX calls to request weather data or news or other info such as a place etc. to built some web apps displaying the info and all this can happen asynchronously.
So the client sends AJAX calls to a certain web server using Requests (like GET, POST requests etc.) and get a Response back to your site to display the info.
API stands for Application Programming Interface. API is basically a software that can interact with another software which allows them to communicate with each other for exchange of information.
API can be servers that has been created for serving of data to third-parties. APIs can serve or display data through AJAX calls.
For example, if a website wants to know the hotel rooms available at a certain hotel in Paris for tomorrow, it sends an AJAX call to the API containing that real-time data and fetch the details to display them on the site. There are APIs available for everything on the internet, from flight info to the tending movies and music to breaking news. APIs actually powers and makes the modern web possible.
JSON on the other hand is nothing but the most popular API data format. So, the API data travels through the web mostly through the JSON format. JSON stands for JavaScript Object Notation and its a standardised format for structuring data. JSON is essentially the universal format for transmitting data on the web through web APIs.
Previously the data format which was used was called XML, but those days are gone. Now JSON is pretty much the standard. JSON is basically a JavaScript object behind the scene.