Populating Google Map Markers from PHP array using json_encode

前端 未结 1 1715
滥情空心
滥情空心 2021-01-27 16:37

When I use the hard coded javascript array as input for the map markers the markers show up just fine, so I know that the code I\'m using to display the markers is good.

相关标签:
1条回答
  • 2021-01-27 17:19

    Remove the single-quotes, otherwise locations will be a string and not an array:

    var locations = '<?php echo json_encode($locations); ?>';
    //--------------^--------------------------------------^
    
    0 讨论(0)
提交回复
热议问题