Created
June 7, 2012 16:44
-
-
Save ryanclark2/2889967 to your computer and use it in GitHub Desktop.
One Ajax Call
This file contains 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
$.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