Otaqui.Com

Pete Otaqui’s blog about web development and everything else

Shortest way to create an XHR in Javascript

leave a comment

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

Written by pete

April 18th, 2007 at 5:47 pm

Posted in Professional

Tagged with

Leave a Reply