Skip to content

Instantly share code, notes, and snippets.

@joeydi
Last active August 29, 2015 14:06
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 joeydi/04abc19541681907799e to your computer and use it in GitHub Desktop.
Save joeydi/04abc19541681907799e to your computer and use it in GitHub Desktop.
initComposer = function() {
if (window.XMLHttpRequest) {
httpRequest = new XMLHttpRequest();
} else if (window.ActiveXObject) {
try {
httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e) {
try {
httpRequest = new activeXObject("Microsoft.XMLHTTP");
}
catch (e) {}
}
}
},
callComposer = function(url, eventHandler) {
httpRequest.onreadystatechange = function() {
if (httpRequest.readyState === 4 && httpRequest.status === 200) {
eventHandler();
}
};
httpRequest.open('GET', url());
httpRequest.send();
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment