title: How to get only the contents of a div not a full page using javascript
body: <p>I want to be able to get only the contents of a div instead of loading the full page.</p>
  
  <p>My current js is:</p>
  
  <pre><code>    $(document).ready(function(){
      $("#myform").validate({
          debug: false,
          rules: {
              name: "required",
              email: {
                  required: true,
                  email: true
              }
          },
          messages: {
              name: "Please let us know who you are.",
              email: "A valid email will help us get in touch with you.",
          },
          submitHandler: function(form) {
              $.post('file.php', $("#myform").serialize(), function(data) {
                  $('#results').html(data);
              });
          }
      });
  });
  </code></pre>
  
  <p>It's loading the whole page when I submit the form, I want it to only load the contents of one div.</p>