title: How to prevent form resubmit on refresh while form is submitting
body: <p>I'm using nodeJs, handlebars, and JavaScript to submit a form with the post action but form submission is taking time due to a lot of data to store in DB son while the form is submitting if someone refreshes the page it creates duplicate data in DB.
  can you tell how can I prevent this from happening?</p>
  
  <p>I create a button to submit the form and submit using Js like this.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function sumitform() {
    var myform = document.getElementById("myForm");
    myform.submit();
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;form id="myForm" action="/path/toNodePostApi" method="post"&gt;
    &lt;input name="name" value="{{{data}}}"&gt;
    &lt;input id="btnsubmit" class="btn" type="button" value="submit" onclick="sumitform()"&gt;
  &lt;/form&gt;</code></pre>
  </div>
  </div>
  </p>