title: Google Maps setTimeOut updating coordinates jquery javascript
body: <p>So, I'm trying to update the markers/users position every one five second in order for the user to be updated live with their position. I can get the current positions and coordinates to update with the right interval but then I want the marker on the Google Map to update, I cannot understand where to put in my coordinates in the Google Maps code in order to live update?</p>
  
  <pre><code>    var x=document.getElementById("demo");
  
      function startGeolocation() {
        var options;
        navigator.geolocation.getCurrentPosition(geoSuccess, options);
        setTimeout(startGeolocation, 1000);
      }
  
      function geoSuccess(position) {
        var gpsPosition = position;
        var coordinates = gpsPosition.coords;
        myLat = coordinates.latitude;
        myLong = coordinates.longitude;
        //x.innerHTML="Latitude: " + myLat + 
        //"&lt;br&gt;Longitude: " + myLong;
        }
  
       var map;
  
       function initialize() {
       var mapOptions = {
       zoom: 18,
       mapTypeId: google.maps.MapTypeId.ROADMAP
       };
       map = new google.maps.Map(document.getElementById('map-canvas'),
       mapOptions);
  
     // Try HTML5 geolocation
     if(navigator.geolocation) {
     navigator.geolocation.getCurrentPosition(function(position, options) {
     //trying to pass in myLat and myLong from the live update above
     var pos = new google.maps.LatLng(position.coords.myLat,
                                     position.coords.myLong);
  
    var infowindow = new google.maps.InfoWindow({
      map: map,
      position: pos,
      content: 'You are here'
    });
  
    map.setCenter(pos);
    }, function() {
    handleNoGeolocation(true);
   });
   } else {
  // Browser doesn't support Geolocation
   handleNoGeolocation(false);
   }
   }
  
   function handleNoGeolocation(errorFlag) {
   if (errorFlag) {
   var content = 'Error: The Geolocation service failed.';
   } else {
   var content = 'Error: Your browser doesn\'t support geolocation.';
   }
  
   var options = {
   map: map,
   position: new google.maps.LatLng(60, 105),
   content: content
   };
  
    var infowindow = new google.maps.InfoWindow(options);
    map.setCenter(options.position);
   }
  
   google.maps.event.addDomListener(window, 'load', initialize);
  </code></pre>