title: jquery .submit();
body: <p>Since Instamapper is closing down and I am doing this project where I am trying to get to the Moon counting how much km I have walked I tried to make my web app, which I could use instead. I got everything working except I wanted to automatically submit my form with data every 5 sec. I tried to use .submit() but it isn't working. </p>
  
  <p><strong>EDIT:</strong>
  The submit() function is not working, here is the error from the console:</p>
  
  <blockquote>
    <p>Uncaught TypeError: Property 'submit' of object # is
    not a function</p>
  </blockquote>
  
  <p>Here is the code:</p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;title&gt;Untitled Document&lt;/title&gt;
  &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"     type="text/javascript"&gt;&lt;/script&gt;
      &lt;script type="text/javascript"&gt;
      $(document).ready(function(){
      setTimeout(function(){
          $('form#target').submit();
      }, 5000);
      });
      &lt;/script&gt;
  &lt;?php
  if(isset($_POST['submit'])) {
      echo 'works';
  }
  $device = 'vPhone';
  $date = new DateTime();
  $timest = $date-&gt;getTimestamp();
  ?&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;form action="" method="post" id="target"&gt;
  &lt;input type="text" value="&lt;?=$timest?&gt;" name="timestamp" /&gt;
  &lt;input type="text" value="&lt;?=$device?&gt;" name="device" /&gt;
  &lt;input type="submit" name="submit" id="submit" /&gt;
  &lt;/form&gt;
  &lt;script&gt;
  var x=document.getElementById("target");
    if (navigator.geolocation)
      {
      navigator.geolocation.getCurrentPosition(showPosition);
      } else {x.innerHTML="Geolocation is not supported by this browser.";}
    function showPosition(position)
      {
        x.innerHTML += "&lt;input type='text' name='lat' value='" + position.coords.latitude + 
    "' disable&gt;&lt;br&gt; &lt;input type='text' name='lat' value='" + position.coords.longitude + "'     disable&gt; "; }
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>