I am new to the ranch. I have been trying my best to resolve this issue but I am not able to figure out the issue. Here is what I am trying to do.
1.I have a landing page for my app called index.jsp.
2.I have a form with a text box named "cardname" with a submit button
3.When I click the submit button, an AJAX POST call is made to a Servlet which returns an XML that has the payment details for the selected card.
4.The responseText coming back to the AJAX call shows the XML, however when I try responseXML I am getting a null. Here is what I have checked to make sure before opening up this question:
a. I have made sure there XML structure is fine (I think I am doing it right )
c. I used alert to show the XML that came back on the responseXML, but I got [object XML] message.
5. I could not attach the code, but the responseXML is below. Thanks for reading my post.
Here is the XML that the servlet returns. The XML is generated using JAXB inside the servlet.
even we are pardonning the self-fabricated confusion of xmlDoc, one referring to .responseXML the other from being a reference to a parser instance created anew. The xmlDoc referring to .responseXML is an object not a String loosely speaking. So the last post is a regression rather than progression toward resolving a problem, whatever it is.
If you want to re-build the document and that you have .responseText error free, you can do that with .responseText (not with .responseXML).
If you stick the approach using responseXML, your successive posts are ambiguous. At some places, it seems you get responseXML non null, at others, null. In any case, if responseXML is corrected populated with the proper setting up server-side on the contentType, the only thing you should have to change is this.
The reason is that xmlDoc being the document object, its "firstChild" might not be the root element. So the result of that line is far from stable, and it might result in something else rather than the root element.