this is php code for get value

while ($row = $activeRiders->fetch(PDO::FETCH_ASSOC)){ $rider_name = $row['RiderName']; $longitude = $row['CurrentLongitude']; $latitude = $row['CurrentLatitude']; $locations[]=array( $rider_name, $latitude, $longitude ); } $markers = json_encode( $locations );

Jquery function

$(document).ready(function() {
        $('#map').height($('.page-container').height());
        $( window ).resize(function() {
            $('#map').height($('.page-container').height());
        });
        <?php
        echo "var markers=$markers;\n";
        ?>

Initialize Map

map = new GMaps({
            el: '#map',
            lat: 24.8615,
            lng: 67.0099,
            zoom: 12,
            zoomControl : true,
            zoomControlOpt: {
                style : 'SMALL',
                position: 'TOP_LEFT'
            },
            circleOptions: {
                fillColor: '#ffff00',
                fillOpacity: 1,
                strokeWeight: 5,
                clickable: false,
                editable: true,
                zIndex: 1
            },
            panControl : false,
            streetViewControl : false,
            mapTypeControl: false,
            overviewMapControl: false,
    var i = 0;
        setInterval( function(){
            map.addMarker({
                lat: markers[i][1],
                lng: markers[i][2],
                icon: 'http://calldakaar.com/dashboard/assets/images/admin/bike.png',
                animation: google.maps.Animation.DROP,
                draggable:true,
                title: markers[i][0]
            });
            i += 1;
        },100);