私はここに新しい問題があります、私はinfowindow、任意の提案の内容の中でPHPから変数をエコーしたいですか?jqueryの 'コンテンツ'の中でエコー作業を行う方法、Googleマップinfowindow
ここは私のコードです。infowindowの内容の中に、私はPHPの変数で置き換えなければならないhtmlコードを使用しています。例:用 :deviceid1はデータベース
var trieste = new google.maps.LatLng(45.6111555,13.8022614);
var mapOptions = {
zoom: 12,
center: trieste,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map($("#map_canvas")[0], mapOptions);
var places =
[
{
"position": [45.6466883,13.7631226]
},
{
"position": [45.6433281,13.7895584]
},
{
"position": [45.6017884,13.6673355]
},
{
"position": [45.622442,13.7641525]
}
]
var currentPlace = null;
var icons=["green.png","red.png","blue.png","yellow.png"];
var i=0;
$(places).each(function() {
var place = this;
var marker = new google.maps.Marker({
position: new google.maps.LatLng(place.position[0], place.position[1],place.position[2],place.position[3]),
map : map,
icon : icons[i]
});
if(i==0)
{
var infowindow = new google.maps.InfoWindow({
content: '<ul><li>Device ID1</li><li>Device configuration1</li><li>Device Description1</li></ul><a href="riacqua/activepanel.php">Goto RIACQUA</a>'
});
google.maps.event.addListener(marker, 'mouseover', function() {
infowindow.open(map, marker);
});
google.maps.event.addListener(marker, 'mouseout', function() {
infowindow.close();
});
}
jQueryの質問が多分PHPの質問になります。 –
私はjqueryとphpの初心者ですが、それは問題だと思います – Vibing
javascriptコードは、外部の '.js'ファイル、' .html'ファイル、または '.php'ファイルです。 – jeroen