public
Created

Compatible AJAX Object Initialization

  • Download Gist
ajax.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
function initAjax() {
var objXml = false;
if(window.XMLHttpRequest) {
objXml = new XMLHttpRequest(); // All modern browsers
} else if(window.ActiveXObject) {
try {
objXml = new ActiveXObject("Msxml2.XMLHTTP"); // Internet Explorer 6
} catch(e) {
try {
objXml = new ActiveXObject("Microsoft.XMLHTTP"); // Internet Explorer 5
} catch(ex) {
objXml = false;
}
}
}
return ObjXml;
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.