Ajax response clarification in Jsp

lakewayproppy

New Member
I am evaluating certain conditions sent by a jsp page and sending the ajax response in the format as shown below.\[code\] //Part of the response response.setContentType("text/xml"); response.setHeader("Cache-Control", "no-cache"); response.getWriter().write("<valid>true</valid>");\[/code\]I the above shown code portion i return a value true in the xml tag valid how do i return more than one piece of information in another xml tag in the same response.I tried adding a new xml tag but it wouldn't work.\[code\]response.getWriter().write("<valid>true</valid><name>dave</name>");\[/code\]How can i return more than one piece of information in this format.Currently its working fine if I am returning only one piece of information using the tag valid whose value is being used in the javascript code as follows.\[code\]var msg = responseXML.getElementsByTagName("valid")[0].firstChild.nodeValue;\[/code\]What changes do i need to do here if i want to access the second peiece of information returned in the second xml tag.
 
Back
Top