title: How to submit a form, if some condition is satisfied.
body: <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>  
  $("form.formajax").submit(function(e) {
  
  e.preventDefault();
  
  var data = $(this).serialize();
  var url = $(this).attr("action");
  var form = $(this); // Add this line
  $.post(url, data, function(data) {
  
  
  $(form).children(".loginresult").html(data.loginresult);
  
  if (data.success == 1) 
   {
    // SUBMIT the form here with POST Values (and redirect user)
    }
  
  
  
  });
  return false;
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>      &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"&gt;&lt;/script&gt;
  
  
    &lt;form class="login formajax" action="abc.php" method="post"&gt;
      &lt;input type="email" &gt;
      &lt;input type= "password"&gt;
      &lt;input type="submit"&gt;
      &lt;/form&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>This is my code to submit a form using Ajax. It return some values. </p>
  
  <p>It also return <code>1</code> or <code>0</code> with the name <code>data.success</code></p>
  
  <p>If this condition gets satisfied <code>if (data.success == 1)</code></p>
  
  <p>I want to submit the form (redirect the user + submit post value), but how?</p>