Answers

Question and Answer:

  Home  XHR2

⟩ How do I get the XMLHttpRequest object?

Depending upon the browser...

if (window.ActiveXObject) {

// Internet Explorer

http_request = new ActiveXObject("Microsoft.XMLHTTP");

}

else if...

if(window.XMLHttpRequest)

{

xmlhttpobj=new XMLHttpRequest();

return xmlhttpobj;

}

else

{

try

{

xmlhttpobj=new ActiveXObject("Microsoft.XMLHTTP");

}catch(e)

{

xmlhttpobj=new ActiveXObject("Msxml2.XMLHTTP");

}

}

}

 182 views

More Questions for you: