Thursday 31 March 2016

Working of AJAX


How AJAX works :

  1. AJAX communicates with the server using XMLHttpRequest object. Let's try to understand the flow of ajax or how ajax works by the image displayed below.
  2.  XMLHttpRequest object plays a important role.
  3. User sends a request from the UI and a javascript call goes to XMLHttpRequest object.
  4. HTTP Request is sent to the server by XMLHttpRequest object.
  5. Server interacts with the database using JSP, PHP, Servlet, ASP.net etc.
  6. Data is retrieved.
  7. Server sends XML data or JSON data to the XMLHttpRequest callback function.
  8. HTML and CSS data is displayed on the browser.