0

I want to be able to get only the contents of a div instead of loading the full page.

My current js is:

    $(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);
            });
        }
    });
});

It's loading the whole page when I submit the form, I want it to only load the contents of one div.

Eddie
  • 337
  • 3
  • 17

1 Answers1

0

Refer the below links to find out how the DIV elements can be accessed using JavaScript:

Get content of a DIV using JavaScript

How can get the text of a div tag using only javascript (no jQuery)

):

Community
  • 1
  • 1
Rajesh Omanakuttan
  • 6,788
  • 7
  • 47
  • 85
  • Thanks for the link, I already saw those though. I'm looking for a way to edit what I already have. – Eddie Jan 21 '13 at 12:26