title: jQuery submit() and AJAX event; How can I trigger a regular form submit?
body: <p>I'm working on a project where when the submit button is clicked, I catch the event and run the form through an external service to check that something is valid.</p>
  
  <p>If there is a problem, I pop a dialog telling the user that there was a problem, and give them the option of overriding to continue on.</p>
  
  <p>The problem is how to trigger the form submit. If I just use .submit(), it send the form into the dialog catch again.</p>
  
  <pre><code>$('#editAddr').submit(function(){
      var checkString = addrString();
      $.getJSON('/validate.php' + checkString, function(data){
          if(data == 0){
              var confw = '';
              confw += '&lt;div&gt;&lt;p&gt;&lt;span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"&gt;&lt;/span&gt;';
              confw += 'Failed validation.&lt;/p&gt;&lt;/div&gt;';
  
              var $dialog = $(confw).dialog({
                  title: "Validation Problem",
                  modal: true, resizable: false, width: 500,
                  buttons: {
                      "Edit": function(){
                          $(this).dialog('close');
                      },
                      "Override": function(){
                          $(this).dialog('close');
                          $('#editAddr').submit();
                      }
                  }
              });
          }else{
              $('#editAddr').submit();            
          }
      });
  
      return false;
  });
  </code></pre>
  
  <p>How can I submit this form properly through the dialog button click?</p>
  
  <p>EDIT: Make sure your form does not include a button with the id="submit", or you will break the jQuery .submit()</p>