javascriptxmlcross-server

Cross-site XML access using javascript without server access


I asked a question earlier but did not word it correctly so it got brushed over.

Basically, I am creating a windows 7 gadget that will access XML data from www.weather.gov and display some current conditions.

        function weat()
        {

            var url = "http://www.weather.gov/xml/current_obs/KMSY.xml";


            source.open("GET", url, false);
            source.send(null);
            info = source.responseXML;

            document.write("<table border='1'>");
            var stuff = info.getElementsByTagName("temp_f");

            document.write("<tr><td>");
            document.write(stuff);
            document.write("</tr></td>");
            document.write("</table>");

        }

Basically I am trying to get this to work from my desktop, and I'm not totally sure what the problem is. I still think it is a cross-site problem, since stuff prints as undefined, but I'm not totally sure of that. If anyone could help me, I've been googling possible solutions for about 6 hours now and I'm getting pretty frustrated.


Solution

  • You either need a server-side proxy or you need to find a weather service that supports JSONP