title: How to check if data is passed in ajax
body: <p>I have the below requirement to get the registration form to post the data.
  But I am unable to test it, could anyone please help.
  I want to see whether the data is being passed or not?
  I have both jquery cdn and jquery-validate in place. </p>
  
  <p>I have the <a href="http://plnkr.co/edit/XmsAh20ZjGwtSVFIoaqK?p=preview" rel="nofollow noreferrer">plunker</a></p>
  
  <p>jQuery:</p>
  
  <pre><code>// Code goes here
  
  $(function() {
  
      /* Registration form for the website */
      /* validation */
      $("#register-form").validate({
          rules: {
              firstName: {
                  required: true
              },
              lastName: {
                  required: true
              },
              userName: {
                  required: true,
                  minlength: 4
              },
              email: {
                  required: true,
                  email: true
              },
              password: {
                  required: true,
                  minlength: 8,
                  maxlength: 15
              },
              cpassword: {
                  required: true,
                  equalTo: '#password'
              },
          },
          messages: {
              userName: "please enter a valid user name",
              password: {
                  required: "please provide a password",
                  minlength: "password at least have 8 characters"
              },
              email: "please enter a valid email address",
              cpassword: {
                  required: "please retype your password",
                  equalTo: "password doesn't match !"
              }
          },
          submitHandler: submitForm
      });
      /* validation */
  
      /* form submit */
      function submitForm() {
          var data = $("#register-form").serialize();
          // var data={
          //  firstName: $('#firstName').val(),
          // }
  
          $.ajax({
  
              url: 'http://localhost:8000?userName=&amp;password=&amp;firstName=&amp;lastName=&amp;email=',
              type: 'POST',
              data: data,
  
              beforeSend: function() {
                  $("#error").fadeOut();
                  $("#btn-submit").html('&lt;span class="glyphicon glyphicon-transfer"&gt;&lt;/span&gt; &amp;nbsp; sending ...');
              },
  
              success: function(data) {
                  if (data === 0) {
  
                      $("#error").fadeIn(1000, function() {
  
  
                          $("#error").html('&lt;div class="alert alert-danger"&gt; &lt;span class="glyphicon glyphicon-info-sign"&gt;&lt;/span&gt; &amp;nbsp; Sorry email already taken !&lt;/div&gt;');
  
                          $("#btn-submit").html('&lt;span class="glyphicon glyphicon-log-in"&gt;&lt;/span&gt; &amp;nbsp; Create Account');
  
                      });
  
                  } else if (data == 1) {
  
                      $("#btn-submit").html('&lt;img src="btn-ajax-loader.gif" /&gt; &amp;nbsp; Signing Up ...');
  
                  } else {
  
                      $("#error").fadeIn(1000, function() {
  
                          $("#error").html('&lt;div class="alert alert-danger"&gt;&lt;span class="glyphicon glyphicon-info-sign"&gt;&lt;/span&gt; &amp;nbsp; ' + data + ' !&lt;/div&gt;');
  
                          $("#btn-submit").html('&lt;span class="glyphicon glyphicon-log-in"&gt;&lt;/span&gt; &amp;nbsp; Create Account');
  
                      });
  
                  }
              }
          });
          return false;
      }
  });
  </code></pre>