title: How to stop form submit from going into a loop?
body: <p>This is the current situation, and the code is self explanatory.</p>
  
  <p>Form Html</p>
  
  <pre><code>&lt;form id="register" action="example.com/signup" method="post" accept-charset="utf-8" enctype="multipart/form-data"&gt;
      &lt;input id="email" type="email" name="email"&gt;
      &lt;label for="email"&gt;Email&lt;/label&gt;&lt;br /&gt;
  
      &lt;input id="password" type="password" name="password"&gt;
      &lt;label for="password"&gt;Password&lt;/label&gt;
  
      &lt;button type="submit" name="register" id="submit" value="Submit"&gt;Submit&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Javascript</p>
  
  <pre><code>$('#register').submit(function(event){
  
  event.stopPropagation();
  event.preventDefault(); 
  
  alert('fff');
  
  if(condition)
  {
      $(this).submit();
  }
  else
  {
      //dostuff
      if(condition)
      {
          //dostuff
          return;
      }
      else
      {
          $(this).submit();
      }
  }
  
  });
  </code></pre>
  
  <p>But the form submit goes into the loop, how do I prevent it from happening ?</p>