Custom Search

How does AJAX work

How does AJAX work?

The core idea behind AJAX is to make the communication with the server asynchronous, so that data is transferred and processed in the background. As a result the user can continue working on the other parts of the page without interruption. In an AJAX-enabled application only the relevant page elements are updated, only when this is necessary.

  1. Initial request by the browser – the user requests the particular URL.
  2. The complete page is rendered by the server (along with the JavaScript AJAX engine) and sent to the client (HTML, CSS, JavaScript AJAX engine).
  3. All subsequent requests to the server are initiated as function calls to the JavaScript engine.
  4. The JavaScript engine then makes an XmlHttpRequest to the server.
  5. The server processes the request and sends a response in XML format to the client (XML document). It contains the data only of the page elements that need to be changed. In most cases this data comprises just a fraction of the total page markup.
  6. The AJAX engine processes the server response, updates the relevant page content or performs another operation with the new data received from the server. (HTML + CSS)
Your Ad Here