Created
August 12, 2013 08:28
-
-
Save achudars/6209068 to your computer and use it in GitHub Desktop.
Sample usage of Wunderground Weather API with AJAX and JSONP.
Gets current temperature in Celsius degrees in London, UK
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
jQuery.ajax({ | |
url : "http://api.wunderground.com/api/<your key here>/geolookup/conditions/q/UK/London.json", | |
dataType : "jsonp", | |
success : function(parsed_json) { | |
var location = parsed_json['location']['city']; | |
var temp_c = parsed_json['current_observation']['temp_c']; | |
console.log(location + " at "+ temp_c); | |
// jQuery('#temperature').html(temp_c+"°"); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
can i post data with data option of Ajax or we must have to write country name and city in url along with json extension in url