Skip to content

Instantly share code, notes, and snippets.

@lydonchandra
Created May 8, 2012 03:22
Show Gist options
  • Save lydonchandra/2632290 to your computer and use it in GitHub Desktop.
Save lydonchandra/2632290 to your computer and use it in GitHub Desktop.
Serialize XML to String for IE, Firefox, Chrome
// from https://gist.github.com/raw/554178/601c25f8ed6e84715dc36804efad915b4a62956d/XMLSerializer.js
var xmlString = '';
try {
// this works for Firefox, Chrome, Safari
xmlString = new XMLSerializer().serializeToString( clickResult );
} catch (e) {
// this works for IE6+
xmlString = clickResult.xml;
}
alert(xmlString);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment