title: Refresh PHP that grabs Co-Ords for google maps API
body: <p>I am using the google maps API to show the last position a form was submitted to my site. So I am pulling the lon and lat values from a php file as variables but I need the script to refresh every 5 seconds so that the maps marker updates without page reload.</p>
  
  <p>Here is the google api script: </p>
  
  <pre><code>    &lt;script&gt;
  
        function initialize() {
    var myLatlng = new google.maps.LatLng&lt;?php 
  require($DOCUMENT_ROOT . "php_includes/mobile_loc.php");
  
  ?&gt;;
    var mapOptions = {
      zoom: 15,
      center: myLatlng
    }
    var map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);
  
    var marker = new google.maps.Marker({
        position: myLatlng,
        map: map,
        title: 'Last Scan'
    });
  }
  
  google.maps.event.addDomListener(window, 'load', initialize);
  
  &lt;/script&gt;
  </code></pre>
  
  <p>And here is the php file:</p>
  
  <pre><code>    &lt;?php 
  include_once("php_includes/db_conx.php"); 
  
  $sql = "SELECT * FROM patdub ORDER BY STR_TO_DATE(Timestamp, '%d/%m/%Y %H:%i:%s') DESC LIMIT 1"; 
  $query = mysqli_query($db_conx, $sql); 
  $row = mysqli_fetch_array($query);
  
  $lon = $row['Lon'];
  $lat = $row['Lat'];
  
  echo "($lat, $lon)";
  
  ?&gt;
  </code></pre>
  
  <p>Any ideas? I've tried different AJAX methods but just can't seem to figure it out! </p>
  
  <p>Edit: The line of code below is basically the bit I need to refresh every 5 seconds but without any div tags or anything because that interferes with the google api script..</p>
  
  <pre><code>&lt;?php require($DOCUMENT_ROOT . "php_includes/mobile_loc.php"); ?&gt;;
  </code></pre>