I'll employ one example application and several use cases to illustrate the technology features and techniques discussed here. Figure 1 shows the extremely simple data model that illustrates the example use cases. The model represents a customer's account at an online store. The customer has a collection of previous orders, and each order consists of several items.
Figure 1. A simple object model
Although XMLHttpRequest places no restrictions on the format used to send request data, for most purposes it's appropriate to simply send traditional form parameters, so my discussion concentrates on the server's response. The response can also have any text-based format but, as its name suggests, XMLHttpRequest has built-in capabilities for dealing with XML response data. This makes XML the default choice for Ajax responses, so it's a good place to start.