How AJAX works?

The XMLHttpRequest object is how AJAX talks to the server. Let’s look at the picture below to try to figure out how ajax works or how it flows.

how Ajax works and how it flows

How AJAX works, ajax system, ajax example,ajax

From the above example, you can see that the XMLHttpRequest object is very important.

The user sends a request from the UI, and XMLHttpRequest gets a call from JavaScript.
XMLHttpRequest object sends HTTP Request to the server.
Server uses JSP, PHP, Servlet, ASP.net, etc. to talk to the database.
The data is gotten.
The server sends the XMLHttpRequest callback function either XML data or JSON data.
Data in HTML and CSS is shown on the browser.

People also search
Scroll to Top