I'm having trouble displaying a weather icon in a map marker using wunderground's api, Leaflet and Cloudmade. Although I can get the text to appear along with the image URL stored in a variable, I'm unable to make it show up. Below is the code I have been working on:
jQuery(document).ready(function($) {
$.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 icon = parsed_json['current_observation']['icon_url'];
marker1.bindPopup("Current temperature in " +location+ " is: " + temp_f).openPopup();
}
});
});
I attempted the following without any luck:
marker1.bindPopup( <img src=icon> "Current temperature in " +location+ " is: " + temp_f).openPopup();
Do you have any suggestions or tips?