title: Automatic click Submit after 10 seconds in php using jquery
body: <p>I am trying to auto submit for after <code>10s</code> in <code>PHP</code> using <code>jquery</code>. but no action is done.</p>
  
  <p>I tried:</p>
  
  <pre><code>&lt;?php echo "&lt;div class="page-header"&gt;
              &lt;h1 class="h2"&gt;&lt;/h1&gt;
          &lt;/div&gt;
          &lt;script&gt;
              var checkState = function(){
        jQuery.ajax({
          url: 'check_diffex.php?od=$scdate'
        }).done(function(data){
          if(data.diffex &gt;= 10) {
          $('#quizsb').submit();          
        });    
      }    
      checkState();    
              &lt;/script&gt;
      &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jque‌​ry.min.js"&gt;&lt;/script&gt;
      &lt;form method="post" action="qform.php?srn=&lt;?php echo $srn ?&gt;&amp;id=&lt;?php echo $id ?&gt;" enctype="multipart/form-data" class="form-horizontal" id="quizsb"&gt;
  .....
  &lt;/form
  "?&gt;
  </code></pre>
  
  <p><strong>check_diffex.php</strong></p>
  
  <pre><code>&lt;?php
  
  header('Content-Type: application/json');
  if(isset($_GET['od'])){
      $deotd = $_GET['od'];
  }
  date_default_timezone_set('Asia/Calcutta');
  $cdate = date('Y-m-d H:i:s ', time());
  $scdate = strtotime($cdate);
  
  $e = $scdate - $deotd;
  
  // You would calculate a real value here
  echo json_encode([
    'diffex' =&gt; $e
  ]);
  ?&gt;
  </code></pre>
  
  <blockquote>
    <p>Before Answering Please look at this <a href="https://stackoverflow.com/questions/47047992/automatic-click-submit-after-10-seconds-in-php-using-jquery#comment81043307_47047992">comment</a></p>
  </blockquote>