Hi,
I am quite new to web development. I wrote this script to display current weather it works fine locally. But not able to run on my web server - I get "Access Denied error". Can anyone help? or suggest a better way to get yahoo weather on my web site?
<html>
<head>
</head>
<body>
<table border=1><tr>
<td width="300">
Chalaka Salpadoru
</td>
<td width="300">
<SCRIPT type=text/javascript>
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null){
document.write("Browser does not support HTTP Request");
// return;
}
var url="http://weather.yahooapis.com/forecastrss?p=NZXX0049&u=c"
xmlHttp.open("POST",url,false)
xmlHttp.send(null)
response = xmlHttp.responseXML;
hellooo = response.getElementsByTagName("description")[1].childNodes[0].nodeValue
document.write("<b>Current Weather in Wellington</b><br>");
document.write(hellooo)
function GetXmlHttpObject(){
var xmlHttp=null;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
</SCRIPT>
</td>
</tr></table>
</body>
</html>
Thank you
Chalaka