Created
September 14, 2012 03:19
-
-
Save jorgepinon/3719599 to your computer and use it in GitHub Desktop.
get local forecast using YQL via ajax
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var query = escape('select item from weather.forecast where woeid=2450080'), | |
url = "http://query.yahooapis.com/v1/public/yql?q=" + query + "&format=json&callback=w"; | |
$.ajax({ | |
url: url, | |
dataType: 'jsonp', | |
jsonpCallback: 'w', | |
success: function(data) { | |
var cond = { | |
text: data.query.results.channel.item.condition.text, | |
temp: data.query.results.channel.item.condition.temp | |
} | |
$("#mb").html("Here in Miami Beach, Yahoo! Weather says it's " + cond.temp + "\°\;" + " and " + cond.text ); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment