AJAX can be used in javascript to return text output (used to inject html and javascript dynamically in a page).Text output can be used to return data also, and regular expresssion can extract the required data. We could even use JSON to construct a
java script object from a
servlet and return it. Now this can be evaled and javascript object is created at runtime. Thus we have many different ways of doing this. Then What is the advantage of returning xml output through AJAX ?