1.

How Do I Get The Xmlhttprequest Object?

Answer»

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");
}
}
}

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");
}
}
}



Discussion

No Comment Found