Skip to content

Instantly share code, notes, and snippets.

@eligrey
Created August 21, 2009 21:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eligrey/172431 to your computer and use it in GitHub Desktop.
Save eligrey/172431 to your computer and use it in GitHub Desktop.
xml.send()
XML.prototype.function::send = function (uri, callback) {
var prettyPrinting = XML.prettyPrinting,
req = new XMLHttpRequest();
req.open("POST", uri, false);
req.setRequestHeader("Content-Type", "application/xml");
if (typeof callback === "function") {
req.onreadystatechange = function () {
this.readyState === 4 && callback(this);
};
}
XML.prettyPrinting = false;
req.send(this.toXMLString());
XML.prettyPrinting = prettyPrinting;
return req;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment