AJAX response contains original page!?!
I'm hoping someone can help me out here. I've only just started with AJAX and am a little lost. I'm writing a JSP application, using Spring MVC, and AJAX.
I have a JSP which is initially rendering, then on a user action, is posting a request back to my control servlet using AJAX. I then do the following,
response.setContentType("text/xml");
response.setHeader("Cache-Control", "no-cache");
response.getWriter().write("<message>test</message>");
response.getWriter().flush();
The problem I'm finding is, that back in my Javascript of the JSP, when I'm inspecting the returned XMLHttpRequest, the responseText contains the source HTML from the originally rendered page. My piece of XML is pre-appended to this. However, due to the strange nature of the returned text, the responseXML is showing parseerror.
In the examples I've found online, often the response buffer isn't flushed - however, when I've tried this, my new XML doesn't appear at all on the response - either in the responseText or responseXML.
Please can someone save me a lot of head scratching? Thanks in advance.

