I’ve been trying to serialize an XML (jQuery object) to string to POST it to server.
<script>
$(function(){
myxml = "<tag>just a sample here</tag>";
myxml = $(myxml);
if (window.ActiveXObject){
var xmlString = myxml.xml;
} else {
var oSerializer = new XMLSerializer();
var xmlString = oSerializer.serializeToString(myxml);
}
console.log(xmlString);
}
</script>
This code doesn’t work. FF throws a security error (didn’t check other browsers, but it is already enough that FF doesn’t run this script).
Just to sum up the experience.
Adding [0] to jQuery selector helped to address XML-type object (see my comments above):