Page 1 of 1

Displaying Weather Data from Ajax using simpleWeather.js

Posted: Mon Sep 26, 2016 8:45 pm
by mikethedj4
See it in Action on Codepen: https://codepen.io/mikethedj4/pen/MepVBx
See it in Action on kodeWeave: https://mikethedj4.github.io/kodeWeave/ ... 32e2943d2c

Screenshot:
Image

This is made possible using a JQuery plugin called simpleWeather. Please refer to http://simpleweatherjs.com/ for all the information about this plugin.

Here's a basic demonstration of simpleWeather.
Code: Select all
var loadWeather = function(location, woeid) {
  return $.simpleWeather({
    location: location,
    woeid: woeid,
    unit: 'f',
    success: function(weather) {
      $('.location').text(weather.city);
      $('.temperature').html(weather.temp + '°' + weather.units.temp);
      $('.climate_bg').html('<i class="icon icon-' + weather.code + '">');
      $('.humidity').text(weather.humidity + '%');
      return $('.windspeed').text(weather.wind.speed + weather.units.speed);
    },
    error: function(error) {
      return $('.error').html('<p>' + error + '</p>');
    }
  });
};

loadWeather('Chicago, IL', '');
Please refer to http://simpleweatherjs.com/ for all the information about this plugin.