Ajax Request Cycle

  1. The server creates a page with user controls (e.g. links, menus, buttons) and javascript.
  2. The browser displays the page.
  3. A user performs an action (e.g. clicks on a link, presses a button), which executes javascript statements in the browser.
  4. The javascript initiates an XMLHTTPRequest (XHR) to the server requesting a response.
  5. The server responds with javascript code (but see note).
  6. The browser executes the sent javascript code, which typically inserts content into the web page.

Note: instead of sending javascript code, the server may send content. The browser then has javascript code that executes upon receipt of content. The browser code places the content in a designated element.