Get weather from Yahoo with jQuery

2019-08-15 00:19发布

问题:

I'm using the Google API to get a user's location on this site. How would I go about getting the weather for that user from Yahoo or somewhere?

UPDATE: Ok so I'm going with Yahoo, but I've never done an HTTP GET request before. Im using jQuery and the following code:

function getWeather () {
            $.get("http://weather.yahooapis.com/forecastrss?w=2502265", function(data){
               alert("Data Loaded: " + data);
             });
        }

However, the alert is only returning "Data loaded", and the rest is blank, so I'm doing something wrong but not sure what.

Also, I need a way of taking my latitude and longitude and fiding the WOEID for them

回答1:

Read about Yahoo Weather, you can pass the location as parameter to their API url and it will give you the result:

http://developer.yahoo.com/weather/