我收到以下错误。
错误
SyntaxError: missing } after property list
content:Al futaim, trading company
<br />
Building M, 36, Saih Shuaib 3 —
PHP代码
$content=$servicecenter->getCompanyName()."<br />".$servicecenter->getAddress()."<br /><button type='button' value='Get Direction' class='button' onclick='closeInfoWindow(),calcRoute()' name='Get Direction'>Get Direction</button>";
脚本
var infowindow = new google.maps.InfoWindow({
content:<?php echo $content; ?>;
});
最佳答案
使用json_encode
并删除行尾的分号:
content: <?php echo json_encode($content); ?> /* no ; here! */
关于javascript - 语法错误 : missing } after property list javascript,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31743618/