Posted by gmurray71
on July 5, 2005 at 2:06 AM PDT
This entry brings up some questions as to using XML as the content type in AJAX.
At JavaOne there has been much talk about AJAX. There have been some discussions
about server-side AJAX components returning other content types than XML. Below
are two general models I see with AJAX today. While there are other strategies
the two below summaries much of what is used today.
- Returning XML/XML Fragments - This strategy allows for structured
data to be interchanged. This strategy requires the server-side component that processes the AJAX request to set content-type header of the HTTP response is set to
"text/xml". The benefit of this approach is that you may retrieve
a DOM object representing the XML document returned from the server-side component in the callback of a the XMLHttpRequest by calling
XMLHttpRequest.responseXML. You may navigate programatically the DOM and extract data from it or insert into the HTML DOM.
Consider this strategy if you want to deal with structured data. Also consider
this strategy if your server-side AJAX processing code needs to communicate with
additional clients other than AJAX clients such as standalone clients, Java applets, or Flash clients
that may want to use the same server-side processing.
may also be passed as text and futher evaluated on the client. Generating client-side
a specific usecase. One interesting use of this strategy is the Dynamic Web Remoting (DWR) framework which uses AJAX to do RPC calls on server-side Java objects.
What type of content do you pass around with AJAX?