-
-
Save jwalsh/2578936 to your computer and use it in GitHub Desktop.
Listing 4.8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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