Skip to content

Instantly share code, notes, and snippets.

@melvincarvalho
Created June 17, 2012 13:04
Show Gist options
  • Save melvincarvalho/2944506 to your computer and use it in GitHub Desktop.
Save melvincarvalho/2944506 to your computer and use it in GitHub Desktop.
post sparql update
postFile = function(file, data) {
if (typeof XMLHttpRequest == "undefined")
XMLHttpRequest = function () {
try { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); }
catch (e) {}
try { return new ActiveXObject("Msxml2.XMLHTTP.3.0"); }
catch (e) {}
try { return new ActiveXObject("Microsoft.XMLHTTP"); }
catch (e) {}
//Microsoft.XMLHTTP points to Msxml2.XMLHTTP and is redundant
throw new Error("This browser does not support XMLHttpRequest.");
};
xhr = new XMLHttpRequest();
xhr.open('POST', file, false);
xhr.setRequestHeader('Content-Type', 'application/sparql-query');
xhr.send(data);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment