title: Update marker on google map every x seconds
body: <p>I am trying to update marker on google map for every x seconds based on the data returned from a AJAX call. The Ajax function is called for every x seconds but the marker is not shown. Below is the JavaScript I wrote. Anyone know the reason? Thanks.</p>
  
  <pre><code>    &lt;script type="text/javascript"&gt;
    var map
    function initialize() {
      var mapOptions = {
        center: new google.maps.LatLng(1.32643, 103.79426),
        zoom: 11
      };
    map = new google.maps.Map(document.getElementById("map-canvas"),
          mapOptions);
    }
  
  
    google.maps.event.addDomListener(window, 'load', initialize);
  
          //Ajax call to get position
    function set_center() {
          var feedback = $.ajax({
              type: 'GET',
              url: 'get_gps_position',
            success: function (data) {
              console.log(data);
                if (data['gps_position_longitude'] != null &amp;&amp; data['gps_position_latitude'] != null ) {
                  var latlng = new google.maps.LatLng(data['gps_position_longitude'], data['gps_position_latitude']);
                  var marker = new google.maps.Marker({
                  position: latlng, 
                  map: map,
                  title:"Hello World!"});
  
                };
  
  
          },
          error: function(data) {
              $("#result").html(data);
              console.log(data)
          }
      });
    }
  
    setInterval(set_center, 10000);
  
  &lt;/script&gt;
  </code></pre>