2012-04-23 15 views
0

所以我有一個地圖我工作的動態加載這樣的:動態加載的Javascript谷歌地圖API:點擊標記彈出

foreach($myposts as $post) : setup_postdata($post); ?>         

    var marker<?php echo $count; ?> = new google.maps.Marker({ position: new google.maps.LatLng<?php the_field('longlat'); ?>, map: map, title:"<?php the_title(); ?>, <?php the_field('address'); ?>", icon:image }); 

    google.maps.event.addListener(marker<?php echo $count; ?>, 'click', function() 
    { 

     alert('you clicked: <?php the_title(); ?> - <?php the_field('address'); ?>'); 

    }); 

    <?php $count++ ?> 

    <?php endforeach; ?> 

我希望它做的是優雅加載標誌是什麼與標題和地址彈出...從PHP是這兩個值:

<?php the_title(); ?> - <?php the_field('address'); ?> 

目前它這一點,但在警告...

那麼,如何設置此所以它出現在在標記上方彈出?

感謝您的幫助!

回答