Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save achudars/6209068 to your computer and use it in GitHub Desktop.
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
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+"&deg;");
}
});
@preetparm
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment