var obj = {id: {bike: {coords: {latitude: 1,longitude: 2},orientation: 5, timestamp: 7}}};
obj[id] = mapId;
alert([1].obj);
obj.id.bike.coords.latitude = lat;
obj.id.bike.coords.longitude = lng;
obj.id.bike.orientation = ori;
obj.id.bike.timestamp = 50;
我遇到了一个严重的问题,我想更改键而不是值,例如,我想将id更改为数字,然后将其更改为Yamaha im,使用php到Java脚本传递变量。
var mapId = "<?php echo $mapId ?>";
var bike = "<?php echo $bike ?>"; //
var lat = "<?php echo $lat ?>"; //
var lng = "<?php echo $lng ?>";
var ori = "<?php echo $ori ?>"; //