How do I get the entire XML string from a XMLDocument returned by jQuery (cross browser)?
If you want both, get the response as XML Document and as string. You should be able to do
success: function(data){ //data.xml check for IE var xmlstr = data.xml ? data.xml : (new XMLSerializer()).serializeToString(data); alert(xmlstr);}
If you want it as string why do you specify dataType:xml
wouldn't then dataType:text
be more appropriate?
I need the actual XML as a string
You want it as plain text instead of XML object? Change dataType
from 'xml'
to 'text'
. See the $.ajax documentation for more options.
You can also easily convert an xml object to a string, in your java script:
var xmlString = (new XMLSerializer()).serializeToString(xml);