Skip to content

Instantly share code, notes, and snippets.

@ryanclark2
Created June 7, 2012 16:44
Show Gist options
  • Save ryanclark2/2889967 to your computer and use it in GitHub Desktop.
Save ryanclark2/2889967 to your computer and use it in GitHub Desktop.
One Ajax Call
$.ajax({
url: "http://api.wunderground.com/api/cd48ac26fb540679/conditions/q/pws:KCASANFR128.json",
dataType: "jsonp",
success: function(parsed_json) {
var location = parsed_json['current_observation']['observation_location']['city'];
var temp_f = parsed_json['current_observation']['temp_f'];
var weather = parsed_json['current_observation']['weather'].toLowerCase();
var iconUrl = parsed_json['current_observation']['icon_url'];
var iconPic = new MyIcon(iconUrl);
var markerRichmond = new L.Marker(new L.LatLng(37.779806, -122.471895), {icon: iconPic});
markerRichmond.bindPopup("Current temperature in " +location+ " is: " +temp_f+ " and it is " + weather);
map.addLayer(markerRichmond);
}});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment