Exchanging data in Ajax
One of the most common problems with the Ajax interface is that the exchange of information between the client browser and the host server normally needs some kind of encoding and post-processing or parsing to convert the data stream into something that is usable directly within the JavaScript application.
Within Ajax that method of encapsulation is XML, a worldwide and well used and understood standard that also has some problems and limitations. The main problem with XML is that the encoding process is expensive and that, on most browsers, the decoding of the XML response is equally time consuming.
Frequently with an Ajax application, the request is based on the contents of the form. The response will be a representation of the information returned by the server in a series of Java objects that you can use to display the information. The resulting sequence is similar to that shown in Figure 1.
Figure 1. Typical Ajax process