Ajax Request Cycle
- The server creates a page with user controls (e.g. links, menus, buttons) and javascript.
- The browser displays the page.
- A user performs an action (e.g. clicks on a link, presses a button), which executes javascript statements in the browser.
- The javascript initiates an XMLHTTPRequest (XHR) to the server
requesting a response.
- The server responds with javascript code (but see note).
- 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.