Tôi đang cố gắng để có được biểu tượng thời tiết để hiển thị trong một điểm đánh dấu bản đồ bằng cách sử dụng api của wunderground, Leaflet và Cloudmade. Tôi đã có văn bản hiển thị và một biến với hình ảnh biểu tượng, nhưng tôi không chắc chắn làm thế nào để làm cho nó hiển thị. Dưới đây là mã của tôi:Hiển thị hình ảnh trong Leaflet Popup
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();
}
});
});
Tôi cố gắng này không có thành công:
marker1.bindPopup(<img src=icon> "Current temperature in " +location+ " is: " + temp_f).openPopup();
Bất kỳ lời đề nghị?