title: jQuery $.ajax function doesn't get data from $(...).validate function
body: <p>I've faced the following trouble while trying to combine jQuery validation (plugin) and sending data to server using ajax. </p>
  
  <p>If I'm using this jQuery method for only posting data to server on its own, everything is OK.</p>
  
  <pre><code>function doAjaxPost() {
      // get the form values
      var name = $('#name').val();
      var pswd = $('#pswd').val();
  
      $.ajax({
      type: "POST",
      url: "${pageContext. request. contextPath}/loginUser.htm",
      data: "name=" + name + "&amp;pswd=" + pswd,
  
      success: function(response){    
          // we have the response
          if(response.status == "OK") {
              $('#info').html("User has been added to the list successfully.&lt;br&gt;"+
                                  "The User Details are as follows : &lt;br&gt; Name : "+ 
                                  response.result.name + " &lt;br&gt; Password: " + response.result.pswd);
              $('#name').val('');
              $('#pswd').val(''); 
          } else {
              $('#info').html("Sorry, there is something wrong with the data provided")
          }
      },
      error: function(e){
          alert('Error: ' + e);
      }
      });
  
  }// end of doAjaxPost
  </code></pre>
  
  <p>But when I'm trying to validate user's input by using jquery.validate.min.js, the response from server shows me that everything is OK, <strong>but the values of name and password are undefinded</strong> I suspect that my method doAjaxPost() fails to extract data from form after jquery.validator. 
  Here is my validation function: </p>
  
  <pre><code>$(document).ready(function(){
          $("#loginform").validate({
  
              submitHandler: function(form) {
                  doAjaxPost();
              },
  
              rules:{
                  name:{
                      required: true,
                      minlength: 4,
                      maxlength: 16,
                  },
                  pswd:{
                      required: true,
                      minlength: 6,
                      maxlength: 16,
                  }, 
  
             },
             messages:{
                  name:{
                      required: "Login - is a mandatory field",
                      minlength: "Name should contain minimum {0} symbols",
                      maxlength: "Maximum symbols - {0}",
                  },
                  pswd:{
                      required: "Password - is a mandatory field",
                      minlength: "Password should contain minimum {0} symbols",
                      maxlength: "Password should contain maximum {0} symbols",
                  },
  
             },
  
          });
  
      });
  </code></pre>
  
  <p>So my question is how to extract data from validated form and pass it to doAjaxPost function? </p>
  
  <p>As I think these variables get nothing from form </p>
  
  <pre><code>var name = $('#name').val();
  var pswd = $('#pswd').val();
  </code></pre>
  
  <p>Maybe I should use a selector like $('#loginform #name') ? I tried it, it doesn't work. Please, help. </p>