Created
July 31, 2014 17:57
-
-
Save mikekavouras/1e59739fa2e787b0edc6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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