title: Update Markers Position every X time
body: <p>I`m trying to Update markers position every X time and wonder what is the best way to do that and if there is good example for it.<Br>
  my code is:<BR></p>
  
  <pre><code>&lt;?php
  include 'connect.php';
  $json= array();
  $res = "SELECT LatLon,fname FROM customers";
  $res = mysql_query($res);
  while($r = mysql_fetch_assoc($res)) {
  
    $XY = explode(",",$r['LatLon']);
  
    $json[]= array($r['fname'],$XY[1],$XY[0]);
  
  }
  
  ?&gt;
  &lt;!DOCTYPE html&gt;
  &lt;html&gt; 
  &lt;head&gt; 
    &lt;meta http-equiv="content-type" content="text/html; charset=UTF-8" /&gt; 
    &lt;title&gt;Google Maps Multiple Markers&lt;/title&gt; 
    &lt;link href="https://google-developers.appspot.com/maps/documentation/javascript/examples/default.css" rel="stylesheet"&gt;
      &lt;script src="https://maps.googleapis.com/maps/api/js?v=3.exp&amp;sensor=false"&gt;&lt;/script&gt;
  
  
    &lt;script type="text/javascript"&gt;
  
      var map;
  
      // Cretes the map
      function initialize() {
        map = new google.maps.Map(document.getElementById('map'), {
          zoom: 5,
          center: new google.maps.LatLng(-33.92, 151.25),
          mapTypeId: google.maps.MapTypeId.ROADMAP
        });
      }
  
      // This function takes an array argument containing a list of marker data
      function generateMarkers(locations) {
  
        for (var i = 0; i &lt; locations.length; i++) {  
  
          new google.maps.Marker({
            position: new google.maps.LatLng(locations[i][1], locations[i][2]),
            map: map,
            title: locations[i][0]
          });
        }
      }
    &lt;/script&gt;
  
  &lt;/head&gt; 
  &lt;body&gt; 
    &lt;div id="map" style="width: 1000px; height: 700px;"&gt;&lt;/div&gt;
     &lt;script type="text/javascript"&gt;
  
        window.onload = function () {
        initialize();
        var locations = &lt;?php echo json_encode($json); ?&gt;;
      //setInterval(function(){generateMarkers(locations);},1000);
        generateMarkers(locations);
      };
    &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I need to put the data in other file? if yes how to do that? and how I can make the refresh only on the markers and not on the page.<br>
  any suggestions?<br>
  thanks!</p>