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开发者_如何学Python to do that.. ??
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.
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)
精彩评论