XML HTTP Request

admin

Administrator
Staff member
I am using JavaScript and XML to retrieve weather data from weather.com. The script works fine when I run it from a local PC, but when I upload it to my ISP, it doesn't work. They are of little help. Here's the code:


try
{
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
alert(xmlhttp);
}
catch (E)
{
xmlhttp = false;
}
}
if (!xmlhttp && typeof XMLHttpRequest!='undefined')
{
xmlhttp = new XMLHttpRequest();
}
xmlhttp.open("GET", "http://www.weather.com/weather/local/93063?lswe=93063&lwsa=WeatherLocalUndeclared",true);


The code fails to create an object with either of the following two lines:

xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
OR
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");

and generates a Permission Denied error when it gets to:

xmlhttp = new XMLHttpRequest();

My ISP tells me that I must use:

xmlhttp = new ActiveXObject("Msxml2.ServerXMLHTTP");

but this also fails.

Any ideas?

Thanks,
Tim
 
Back
Top