Skip to content

Instantly share code, notes, and snippets.

@jorgepinon
Created September 14, 2012 03:19
Show Gist options
  • Save jorgepinon/3719599 to your computer and use it in GitHub Desktop.
Save jorgepinon/3719599 to your computer and use it in GitHub Desktop.
get local forecast using YQL via ajax
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 + "\&deg\;" + " and " + cond.text );
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment