9
wundergroundのapi、Leaflet and Cloudmadeを使用して地図マーカーに天気アイコンを表示しようとしています。私はテキストを表示して、変数をアイコン画像で表示していますが、表示する方法がわかりません。ここに私のコードは次のとおりです。リーフレットポップアップに画像を表示
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();
任意の提案ですか?あなたにも引用符でタグを囲む必要がありますので、