Ajax Request Cycle

  1. The server sends 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 data (but see note below)
  6. The browser processes the data, often displaying it.

Note: instead of sending data, the server may send javascript code, which is then executed by the browser. However, our examples will only send data.