In doing so, I can ensure that I build the various functions that might be required to
handle the various issues. It also helps me think through the entire process instead of thinking
strictly of the end goal.
Figure 5-6 is a sample flowchart that shows what might be involved in updating the data
within an HTML table on the page. You??™ll notice that expired user sessions??”a common problem
in an authenticated application??”have even been taken into account.
Figure 5-6. A flowchart explaining the interaction process that might exist to update a data table
CHAPTER 5 n AJAX AND DATA EXCHANGE 105
With an understanding of the planning involved in implementing an Ajax-enabled interface,
you??™ll now get an explanation of the different ways data can be exchanged. After that,
you??™ll dive into actually building the Ajax object and planning for all of these scenarios.
Data Formats in Ajax
When you begin to look at data exchanges between the server and client with Ajax, you need
to understand the different data formats that can be used to exchange data. You have access
to two properties when an Ajax call returns to retrieve the data sent back from the server:
responseText and responseXML.With responseXML, you have an XML object automatically
ready to go. With responseText, you have to parse it into whatever format you think you need.
nNote The responseXML property will be populated only if the server returns a valid XML document with
the MIME type text/xml.
Pages:
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170