Skip to content

Instantly share code, notes, and snippets.

View ear1grey's full-sized avatar

Rich Boakes ear1grey

View GitHub Profile
@ear1grey
ear1grey / gist:5343332
Last active December 15, 2015 23:49 — forked from anonymous/gist:5340810
This is a slight restructuring which removes one of the HTTP calls (the null one) and moves the callback code within the addItem function, forming a closure.
function createObject() {
var request_type;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
request_type = new ActiveXObject("Microsoft.XMLHTTP");
}
else{
request_type = new XMLHttpRequest();
}
return request_type;