title: jquery validator form: how to access form action, after the completion of a remote email validation
body: <p><strong>History:</strong> I started this issue off previously in <a href="https://stackoverflow.com/questions/31966294/form-post-is-omitted-after-jquery-validation-is-completed">this thread</a>. I spent sometime trying to get the remote validation working so I refused to believe that was what was causing me grief.</p>
  
  <p><strong>Present:</strong> I am using jQuery Validator and I have updated the js to version 1.14.0. This process is working smoothly. All fields are being checked and validated, I even added few extra checks to help me identify issues:</p>
  
  <p><code>invalidHandler</code> and <code>$("#submitBTN").click()</code>, detailed below.</p>
  
  <p>Both of these options would report back if the validation failed, and the button also reported passed validations by calling <code>$(form).valid();</code></p>
  
  <p>I have a remote validation which is verifying the email address, checking to see if it is already in the database. It is working. I submit this request using a post. Should I be using an alternate technique? I say this because the post of the form upon validation is not being submitted.</p>
  
  <p>I do not even make it inside of <code>submitHandler</code> but if I comment out the remote check I am able to access <code>submitHandler</code> and the form action is processed.</p>
  
  <p>I have reviewed <a href="http://jqueryvalidation.org/remote-method/" rel="nofollow noreferrer">jQuery Validation Remote</a> rules but it is very simply laid out so what have I done incorrectly?</p>
  
  <p>Here is my html form code:</p>
  
  <pre><code>&lt;form  id="signup_form" name="signup_form"  method="post" action="registration"&gt;  
    &lt;h2&gt;E-MAIL ADDRESS&lt;/h2&gt;
    &lt;input value="&lt;?=$uEmail?&gt;" type="text" name="signup_email" id="signup_email" /&gt;&lt;br /&gt;
  
    &lt;h2&gt;PASSWORD&lt;/h2&gt;
    &lt;input type="password" name="requiredpWord" id="requiredpWord"&gt;&lt;br /&gt;
  
    &lt;h2&gt;CONFIRM PASSWORD&lt;/h2&gt;
    &lt;input type="password" name="requiredcpWord" id="requiredcpWord"&gt;&lt;br /&gt;
  
    &lt;button id="submitBTN" type="submit" value="COMPLETE SIGNUP"&gt;COMPLETE SIGN UP&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Here is my jQuery Validation (<strong>Note</strong> I use a mix of  <code>console.log</code> &amp; <code>alert</code> for debugging):</p>
  
  <pre><code>$(function() {
      $("#signup_form").validate({
          rules: {
              signup_email: {
                  email: true,
                  required: true,
                  remote: { 
                      type: 'post',
                      url: 'registration/isEmailAvailable',
                      data: {
                          email:
                              function() {
                                   // console.log(data);
                                  return $( "#signup_email" ).val();
                              }
                      }
                  }
              },
              requiredpWord: {
                  required: true,
                  minlength: 8
              },
              requiredcpWord: {
                  equalTo: "#requiredpWord"
              }
          },
         messages: {
              signup_email: {
                  required: "Please provide an email",
                  email: "Please enter a valid email address"//,
              },
              requiredpWord: {
                  required: "Please provide a password.",
                  minlength: "Your password must be at least 8 characters long"
              },
              requiredcpWord: "Your passwords do not match."
          },
          invalidHandler: 
              function(form, validator) {
                  var errors = validator.numberOfInvalids();
                  if (errors) {
                      var message = errors == 1
                      ? 'Please correct the following error:\n'
                      : 'Please correct the following ' + errors + ' errors.\n';
                      var errors = "";
                      if (validator.errorList.length &gt; 0) {
                          for (x=0;x&lt;validator.errorList.length;x++) {
                              errors += "\n\u25CF " + validator.errorList[x].message;
                          }
                      }
                      console.log(message + errors);
                  }
                  validator.focusInvalid();
              },
          //added this to see if the form would post, did not change it
          submitHandler: 
              function(form) {
                  alert("form submitted");
                  // do other things for a valid form
                  form.submit();
              }
      });
  })
  </code></pre>
  
  <p>Here is my button js validation:</p>
  
  <pre><code>$( "#submitBTN" ).click(function() {
    alert( "Valid: " + $("#signup_form").valid() );
  });
  </code></pre>
  
  <p>Here is my simple php validation script that the after the form is validated I can read it:</p>
  
  <pre><code>var_dump($_POST);
  </code></pre>
  
  <p><strong>Validation with Remote Section Enabled:</strong></p>
  
  <p>When I press submit the alert reports: </p>
  
  <p><code>Valid: true</code>. </p>
  
  <p>The console reports the validation post of the email address. Nothing else occurs, or is reported. The page remains on the form. </p>
  
  <p><strong>Validation with Remote Section Disabled/Commented Out:</strong></p>
  
  <p>If I comment out the remote validation section completely:</p>
  
  <p>I view the following alerts:</p>
  
  <p><code>Valid: true</code> &amp;&amp; <code>form submitted</code></p>
  
  <p>Followed by the var_dump of the $_POST. Which displays that the form action has been completed.</p>
  
  <p>Any suggestions on how I can get this to work would be greatly appreciated?!</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>the remote check pretty much returns the following:</p>
  
  <pre><code>if(!$userHandler-&gt;isEmailAvailable($email)){
      echo json_encode("Email Address is already registered: ".$email);
  }else{
      echo false;
  }
  exit;
  </code></pre>
  
  <p>If a true is returned the result becomes the error message, 1.</p>