I am using ajax with
struts and i open a .do action. In the action i need to write some data on the response and let it go for the callback method of ajax to catch it.
First, responseXML is giving blank on the call back method in AJAX.
Second, responseText is not giving the value i am writing on the response from server side. I think there is something wrong in writing from the server.
I have written the below code:
response.setContentType("text/xml");
PrintWriter out=response.getWriter();
out.print("<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>");
out.println("<message>");
out.println("fahad");
out.println("</message>");
retString="success";
I return success from my action which has the forward path to the same
jsp from which request came.
This is my javascript side code :
function parseDataRetrieved(){
alert("this is data "+ aReq.responseXML);
response = aReq.responseText;
responseText gives values but the not the ones i am writing on server side.
responseXML is blank.
Please advise with the sample code .