Skip to content

Instantly share code, notes, and snippets.

@mikekavouras
Created July 31, 2014 17:57
Show Gist options
  • Select an option

  • Save mikekavouras/1e59739fa2e787b0edc6 to your computer and use it in GitHub Desktop.

Select an option

Save mikekavouras/1e59739fa2e787b0edc6 to your computer and use it in GitHub Desktop.
function Weather() {
this.weatherData = null;
}
Weather.prototype = {
fetchLatestWeather: function() {
var self = this;
$.ajax({
url: "https://api.forecast.io/forecast/8040fc5b15adaaafabbe7de9c3ff5458/LATITUDE,LONGITUDE",
type: "get",
dataType: "jsonp",
success(response) {
self.weatherData = response;
self.updateCurrentWeather();
self.updateUpcomingWeather();
},
error: function() {
}
});
},
updateCurrentWeather: function() {
var weather = this.weatherData.currently;
var temp = weather.tempurature;
var icon = weather.icon;
}
};
var weather = new Weather();
weather.fetchLatestWeather();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment