Skip to content

Instantly share code, notes, and snippets.

Created December 28, 2011 20:25
Show Gist options
  • Save anonymous/1529560 to your computer and use it in GitHub Desktop.
Save anonymous/1529560 to your computer and use it in GitHub Desktop.
Listing 4.8
function makeRequest(url, method) {
var xhr;
if (typeof XMLHttpRequest === "undefined") {
return null;
}
xhr = new XMLHttpRequest();
if ("withCredentials" in xhr) {
xhr.open(method, url, true);
return xhr;
};
if (typeof XDomainRequest === "undefined") {
return null;
}
xhr = new XDomainRequest();
xhr.open(method, url);
return xhr;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment