2024-10-10
This commit is contained in:
28
web/bsadmin/assets/js/lib/weather/weather-init.js
Normal file
28
web/bsadmin/assets/js/lib/weather/weather-init.js
Normal file
@@ -0,0 +1,28 @@
|
||||
(function ($) {
|
||||
// "use strict";
|
||||
|
||||
function loadWeather(location, woeid) {
|
||||
$.simpleWeather({
|
||||
location: location,
|
||||
woeid: woeid,
|
||||
unit: 'f',
|
||||
success: function (weather) {
|
||||
|
||||
html = '<i class="wi wi-yahoo-' + weather.code + '"></i><h2> ' + weather.temp + '°' + weather.units.temp + '</h2>';
|
||||
html += '<div class="city">' + weather.city + ', ' + weather.region + '</div>';
|
||||
html += '<div class="currently">' + weather.currently + '</div>';
|
||||
html += '<div class="celcious">' + weather.alt.temp + '°C</div>';
|
||||
|
||||
$("#weather-one").html(html);
|
||||
},
|
||||
error: function (error) {
|
||||
$("#weather-one").html('<p>' + error + '</p>');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// init
|
||||
loadWeather('New York', '');
|
||||
|
||||
})(jQuery);
|
||||
Reference in New Issue
Block a user