在谷歌地图中显示多个标记

时间:2013-01-14 09:18:27

标签: javascript jquery google-maps-markers

到目前为止,我已经完成了从服务器显示多个标记

    urlName = "http://bumba27.byethost16.com/infomagilandia/send_lat_lng.php";
$.post(urlName, function(data) {
    var obj = jQuery.parseJSON ( data );
    $noOfPlace   = obj.i;

    for($i=1;$i<=$noOfPlace;$i++)
        {
        $Lat = obj['lat' + $i];
        $Lng = obj['lng'+$i];

        newPlace = new google.maps.LatLng($Lat,$Lng);
        addNewMarker(newPlace)
        }

    });

    function addNewMarker(newPlace) {
        markers.push(new google.maps.Marker({
        position: newPlace,
        map: map,
        draggable: false,
        animation: google.maps.Animation.DROP
        }));
    }

我有一个数据库,其中6 lat&amp;存储lng我需要在谷歌地图上显示它我从服务器获取数据没有问题但是当我尝试将这些数据作为标记放在谷歌地图上时它只显示第一个(第一个lat&amp; lng)。你能告诉我这是什么问题吗?

0 个答案:

没有答案
相关问题