How do I display this XML document?

How to display the contents of the xml document retrieved from the jquery.ajax()...?

  • I am invoking a web service through $.ajax(). onsuccess I am getting an xml document, now the problem is I need to see the contents of the retrieved xmlDocument.. Is there anyway to do that.. ??

  • Answer:

    Put it to the textarea field as-is $("#textareaID").val(xmlstr); or display with html-encoding: $("#someDivID").text(xmlstr); // jQuery text() function performs html-encoding automatically Simple demo: http://jsfiddle.net/wKhnF/1/ Note dataType: "text", it is required to process the response contents as a text rather then XML object.

Rajesh Rs at Stack Overflow Visit the source

Was this solution helpful to you?

Other answers

Use Firebug to check the response. You can use http://api.jquery.com/jQuery.parseXML/ to read, parse the XML, find, and retrieve elements. $.parseXML(xml)

Jayendra

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.