I’m loading an xml file with jQuery ajax loader, and need to convert it to a string so that I can save it out again using PHP post variables. What is the best way to do this?
<script type='text/javascript'>
jQuery.ajax({
type: "GET",
url: "data.xml",
dataType: "xml",
success: parseXML
});
function parseXML(xml) {
var xml_string = jQuery(xml).text(); // (This doesn't work- returns tagless, unformatted text)
alert(xml_string);
}
</script>
Here it is:
Taken from here