Otaqui.com Blog

Shortest way to create an XHR in Javascript

Nicolas Faugout has a very neat, and tiny, method for creating an XHR object in different browsers :

if (!XMLHttpRequest) {
window.XMLHttpRequest = function() {
return new ActiveXObject('Microsoft.XMLHTTP');
}
}
// ....
var xhr = new XMLHttpRequest();

Via Ajaxian