In an Ajax-enabled environment,
the amount of data that needs to be sent back and forth can be greatly reduced. Requests for
data can also be made while the user is in the midst of completing another task on the page,
negating the need for the user to initiate the request and wait for the entire response sequence
to re-create the page. Responses need to return changes only to the current document, not the
entire page (and any noncached assets such as images or CSS). You can then use JavaScript to
update the document object model (DOM) without the page refresh.
Figure 5-3 illustrates the difference between Ajax and non-Ajax sequences. Ajax can ultimately
mean a more responsive interface, taking less time to complete the same tasks.
CHAPTER 5 n AJAX AND DATA EXCHANGE 102
Figure 5-3. Ajax updates to the client can be made with or without user interaction (in
comparison with the traditional non-Ajax interaction).
When putting together any Ajax-based solution, it??™s important to consider the user. Any
time you override the default behavior of the browser there will suddenly be a number of
points of failure. If something dies or takes too long to process, the user might never know
what happened and might think that the site is broken.
If the request is user-initiated, it??™s important to show users that something is happening.
This is most often done with an animated graphic indicator (see Figure 5-4) placed on or near
where the interaction was initiated.
Pages:
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168