title: AJAX get request, refresh every 5 second
body: <p>I'm currently working on a project and can't really figure out how to refresh the AJAX request. 
  At the moment my code work fine i can display all the Marker but i want to refresh it every 5 sec and receive the new one!
  Below a copy of my script, I try to use setInterval without success jet!
  Help on this will be really great. 
  thanks again.</p>
  
  <pre><code>var gMapsLoaded = false;
  window.gMapsCallback = function(){
      gMapsLoaded = true;
      $(window).trigger('gMapsLoaded');
  }
  window.loadGoogleMaps = function(){
      if(gMapsLoaded) return window.gMapsCallback();
      var script_tag = document.createElement('script');
      script_tag.setAttribute("type","text/javascript");
      script_tag.setAttribute("src","http://maps.google.com/maps/api/js?sensor=false&amp;callback=gMapsCallback");
      (document.getElementsByTagName("head")[0] || document.documentElement).appendChild(script_tag);
  }
  
  
  $(document).ready(function(){
      function initialize(){
          var mapOptions = {
              zoom: 18,
              center: new google.maps.LatLng(51.5207239719, -0.182568696184),
              mapTypeId: google.maps.MapTypeId.ROADMAP};
          map = new google.maps.Map(document.getElementById('map_canvas'),mapOptions);
      }
      $(window).bind('gMapsLoaded', initialize);
      window.loadGoogleMaps();
  });
  
  $(window).load(function update () {
  
  
      $.ajax({
          url: 'get-last.php',
          success:function(data){
              //Loop through each location.
              $.each(data, function(){
                  //Plot the location as a marker
                  var pos = new google.maps.LatLng(this.latitude, this.longitude);
                  new google.maps.Marker({
                      position: pos,
                      map: map
                  });
  
  
  
  
              });
          } ,  complete: function() {
        setInterval(update, 1000);
          }
  
        });
  </code></pre>