我有一些问题,我想在使用GoogleMap API的信息窗口上显示数据,我从数据库中查询并使用php脚本调用并保存在Javascript文本上。这是我的代码
var contentString = '<b>Bermuda Triangle Polygon</b><br>';
var infoo = <?php
include_once("koneksi.php");
$sql3="SELECT a.Informasi from asset a where ID_Asset='AST01'";
$result3 = mysql_query($sql3);
$data3 = mysql_fetch_row($result3);
Print $data3[0];
?>;
contentString += 'Informasi: <br>' + infoo + '<br>';
infoWindow.setContent(contentString);
infoWindow.setPosition(event.latLng);
infoWindow.open(map);
当我更改返回数字数据的查询时,它起作用,但如果返回文本或字符串数据,它就不起作用。任何人帮助
只是为了一致性(因此可以标记答案):
var infoo = "<?php
include_once("koneksi.php");
$sql3="SELECT a.Informasi from asset a where ID_Asset='AST01'";
$result3 = mysql_query($sql3);
$data3 = mysql_fetch_row($result3);
Print $data3[0];
?>";