Home
Ajax
Ajax is an acronym that stands for Asynchronous JavaScript and XML. Ajax is a Web 2.0 development technique used for creating interactive Web applications. The intent is to make Web pages feel more responsive by exchanging small amounts of data with the server behind the scenes. Technically, in order to send and process a request to the server-side, the Web page does not require a reload. JavaScript gathers DOM values on the page, and data is transmitted from the browser to the server through the XMLHTTPRequest object.
Figure | 3 illustrates the overall Ajax interaction between the client browser and the server-side application. The generic sequence of steps that get executed on a typically Ajax submission are as follows:
JavaScript functional invocation-Typically, when an Ajax call takes place, the first step is to emulate what typically happens in a synchronous GET or POST. That is, collect the information from the page that is necessary for processing the server-side request. In the case of Ajax, the collection of these values occurs through a JavaScript function (and retrieves DOM values).
XMLHttpRequest.send-After we have collected all the necessary information from the DOM, a JavaScript object is created and eventually stores all the collected DOM values. In Mozilla-based browsers, this JavaScript object is an XMLHttpRequest object. When fully configured, the XMLHttpRequest object is sent to the server-side via HTTP Request.
Server-side processing-Assuming that the application is based on Java EE, from a Web tier, the Ajax request can either be handled by one of the following Web technologies: Servlet, JSF, or Portlet. When received, the Ajax request from the server-side will continue to execute as usual (accessing a data store, executing business logic, and so forth).
XML response-After the server completes processing, the resulting data is returned in a response, typically in XML format.
XMLHttpRequest.callback-The callback function processes the response. As part of the response, JavaScript function would have to take the response values and update the page (by changing/updating DOM values).
Figure 2-3 Ajax overview
More information about Ajax can be found here:
http://www.ibm.com/developerworks/ajaxRAD v7.5 supports Ajax development with dojo Toolkit and IBM extensions.
Information about the DOJO Toolkit can be found at:
http://www.dojotoolkit.org
ibm.com/redbooks