HTML and CSS Reference
the user it would look like all the page content disappeared and then reappeared a second
or two later.
AJAX started life as an approach rather than a standard. In 1998 Microsoft implemented
a component called XMLHTTP. This allowed content to be dynamically requested from
the server and incorporated into the current page without a page refresh. This functionality
was later adopted by other web browsers as the XMLHttpRequest object. The XMLHt-
tpRequest is currently undergoing the standards process and is considered part of HTML5.
The XMLHttpRequest object allows a web page to send HTTP POST and GET requests
to the server, and receive data in response, but without refreshing the entire web page. For
instance, the request may return a fragment of the page that is then dynamically added to
It is worth examing the key aspects of AJAX:
• Asynchonous : AJAX requests are asynchronous because the main browser thread does
not block while the request is in flight. Responses to requests are handled with callbacks.
This means the user does not need to be aware that a request is in flight, and they can con-
tinue using the web application as though nothing was happening.
• XML : Originally XMLHttpRequest utilized XML as the data exchange format. In fact,
XMLHttpRequest allows any data format to be used, and is now commonly used with
JSON rather than XML. It is also common to return HTML from an AJAX call, therefore
allowing it to be inserted directly into the DOM.
In fact, XMLHttpRequest is not dependent on HTTP either; it is supported with
other protocols such as FTP. In many respects XMLHttpRequest is the worst
Essentially AJAX is a mechanism for asynchronously sending and/or receiving data from