MSN Weather Gadget

I have been able to get my gadget running through pointing it to the weather channel, with a secondary search in msn weather.

But I can not get it to work properly if I point the script to msn weather, it seems that get an error that states that the page is private or in another location.

This Code Works....

function getForecastData(LocationCode, Units)
{
CityNameSpan.innerText="updating...";

self.setTimeout("getForecastData(System.Gadget.Settings.read('locationCode'),System.Gadget.Settings.read('units'));", 1800000);

Units=(Units == "C")? "m":"s";

var location = "http://xoap.weather.com/weather/local/" + LocationCode + "?dayf=" + forclength + "&cc=*&par=" + Math.round(Math.random() * 10000) + "&prod=xoap&key=" + Math.round(Math.random() * 10000) + "&unit=" + Units;

var tmp = new ActiveXObject("Microsoft.XMLHTTP");
tmp.onreadystatechange=function()
{
if (tmp.readyState==4)
{
if (tmp.Status == 200){
parseForecast(tmp.responseText);}
if (tmp.Status == 404){
CityNameSpan.innerText="No Data";}
}
}
tmp.open("GET", location, true);
tmp.Send(null);
}

or should it be pointed to:

function getForecastData(LocationCode, Units)
{
CityNameSpan.innerText="updating...";

self.setTimeout("getForecastData(System.Gadget.Settings.read('locationCode'),System.Gadget.Settings.read('units'));", 1800000);

Units=(Units == "C")? "m":"s";

var location = "http://weather.msn.com/weather/local/" + LocationCode + "?dayf=" + forclength + "&cc=*&par=" + Math.round(Math.random() * 10000) + "&prod=msn&key=" + Math.round(Math.random() * 10000) + "&unit=" + Units;

var tmp = new ActiveXObject("Microsoft.XMLHTTP");
tmp.onreadystatechange=function()
{
if (tmp.readyState==4)
{
if (tmp.Status == 200){
parseForecast(tmp.responseText);}
if (tmp.Status == 404){
CityNameSpan.innerText="No Data";}
}
}
tmp.open("GET", location, true);
tmp.Send(null);
}

Code is problematic in an elderly mind...

Thanks

[2665 byte] By [LorneReap] at [2008-2-18]