Introduction to AJAX
2 min readMay 2, 2021
There are two ways to use HTTP(i.e. HyperText Transfer Protocol) as AJAX and REST. Here we are going to discuss AJAX.
What Is AJAX?
AJAX (i.e. Asynchronous JavaScript And XML) is a web-service. It is a technique(common to server-side and client-side) used by the developers to load dynamic web pages by using HTTP requests to send and receive data from external sources like API and update the pages.
When using HTTP requests, it will not allow the page to load again and again. Instead, it allows the user to stay on the same page and retrieve data from external resources.
How AJAX works?
- Initially, the client sends an HTTP request to the server through the browser.
- The server receives the request from the client, and it looks for the similar data which has been requested by the browser(client-side).
- The server responds to the request with the data which the client is looking for.
- Finally, the client receives the data as a response and processes the data.
Advantages Of using AJAX
- Loads the web pages faster.
- Maintain web pages responsively.
- Prevent the page reloading
- Process asynchronously.
- Supports many browsers.
- Reduces server traffics.
Disadvantages of using AJAX
- Highly depends on JavaScript (The way the JavaScript is handled in the browsers are different)
- Difficult when debugging the web pages.
- Security issues.