您好我正在尝试使用php json构建地图,当我尝试将值传递给javascript时显示错误
未捕获的SyntaxError:意外的令牌a
{
"map": "worldLow",
"linkToObject": "Sharjah",
"images": [{
"id": "Sharjah",
"color": "#000000",
svgPath: targetSVG,//error in this section as it is not passed without double quotes
"title": "Sharjah",
"latitude": "25.340225",
"longitude": "55.395813",
"scale": 1.5,
"zoomLevel": 1.36,
"zoomLongitude": -19.1341,
"zoomLatitude": 49.1712,
"lines": [ {
"Projectname": "masjid",
"latitudes": 12.2392,
"longitudes": -0.84000000
}
]},
{
svgPath: targetSVG,//error in this section as it is not passed without double quotes
"Projectname": "masjid",
"latitude": 12.2392,
"longitude": -0.84000000,
"selectable": "true" }]
}
如何在没有半引号的情况下传递数据
的javascript
function setData(data){
map.dataProvider = JSON.parse(data);
map.validateNow();
}