title: Disable submit button after click and keep POST/REDIRECT/GET working
body: <p>I use the POST/REDIRECT/GET trick to prevent refresh-resend of forms.
  Now I would like to disable a form submit button (after click) that should not be clicked twice.
  Although I tried all javascript examples I found, they all conflict with POST/REDIRECT/GET.
  In most cases it doesn't even submit but just redirects to itself.
  Any solution ? Thanks for your help.</p>
  
  <p>Something I've tried and conflicts is this example:</p>
  
  <p>the script first runs headers.php with this in:</p>
  
  <pre><code>if (isset($_POST['start-diff-scan']))
  {
      $_SESSION['SCAN_START'] = true;
  
      header('HTTP/1.1 303 See Other');
      header('Location: '.APP_URL.'scan.php');
      exit;
  }
  </code></pre>
  
  <p>and then scan.php with this form:</p>
  
  <pre><code>&lt;form name="start-diff-scan" id="start-diff-scan" method="post"&gt;
      &lt;button
          name="start-scan"
          id="start-scan"
          value=""
          class="start-scan btn btn-primary"
          type="submit"
          method="post"&gt;
          Start New Scan
      &lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>and works fine. but the js trick conflicts this. I added the js code at the very end of scan.php</p>
  
  <pre><code>&lt;script&gt;
  $('#start-diff-scan').submit(function()
  {
      $('#start-scan').prop('disabled', true);
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>What happens is it only redirects to the same page (scan.php) without executing anything.
  Thanks for all yoru answers and help so far this is great.
  Any ideas appreciated thanks very much</p>