9
我想要使用wunderground的api,Leaflet和Cloudmade在地圖標記中顯示天氣圖標。我有文字顯示和圖標圖像的變量,但我不知道如何讓它顯示。這裏是我的代碼:在Leaflet彈出窗口中顯示圖片
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();
}
});
});
我想這沒有成功:
marker1.bindPopup(<img src=icon> "Current temperature in " +location+ " is: " + temp_f).openPopup();
有什麼建議?