This repository was archived by the owner on Jan 23, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 143
Home
jamesfleeting edited this page Sep 14, 2010
·
17 revisions
Welcome to the jquery.simpleWeather wiki!
A complete demo can be found at monkeeCreate
You must provide either a zip code (US only) or a location. Postal Code’s outside the US are not supported by the Yahoo Weather API (this is a limitation of the Yahoo YQL Weather API and not of this plugin) so you must use a location for international places. For example if your wanting London weather you would set the location to ‘london, united kingdom’. Yahoo API won’t recognize ‘london, uk’ so you must put the complete country.
If you provide a zip code and a location, the location will take priority and will be used over zip code.
$.simpleWeather({
location: 'london, united kingdom',
zipcode: '76309',
unit: 'c',
success: function(weather) { ... },
error: function(error) { ... }
});
$.simpleWeather({
zipcode: '76309',
unit: 'f',
success: function(weather) {
$("#weather").append("<h2>"+weather.city+", "+weather.region+" "+weather.country+"</h2>");
$("#weather").append("<p><strong>Today's High</strong>: "+weather.high+"° "+weather.units.temp+" - <strong>Today's Low</strong>: "+weather.low+"° "+weather.units.temp+"</p>");
$("#weather").append("<p><strong>Current Temp</strong>: "+weather.temp+"° "+weather.units.temp+"</p>");
$("#weather").append("<p><strong>Wind</strong>: "+weather.wind.direction+" "+weather.wind.speed+" "+weather.units.speed+"</p>");
$("#weather").append("<p><strong>Currently</strong>: "+weather.currently+" - <strong>Forecast</strong>: "+weather.forecast+"</p>");
$("#weather").append('<p><img src="'+weather.image+'"></p>');
$("#weather").append("<p><strong>Sunrise</strong>: "+weather.sunrise+" - <strong>Sunset</strong>: "+weather.sunset+"</p>");
$("#weather").append("<p><strong>Last updated</strong>: "+weather.updated+"</p>");
$("#weather").append('<p><a href="'+weather.link+'">View forecast at Yahoo! Weather</a></p>');
},
error: function(error) {
$("#weather").html("<p>"+error+"</p>");
}
});