Skip to content Skip to sidebar Skip to footer

Jquery - Loading Form Submission In Div Of Parent Page (?)

I have the following code, which works perfectly ... so far. But I want to next have a form load ... read below this code for an explanation. Main Page:
  • HTML:

    <form action="report_output.php"class="load-external" method="get"id="graphIt" data-target="#right_section">
    

    JS:

    $('body').on('submit', 'form.load-external', function(e) {
        e.preventDefault();
        var target = $($(this).data('target'));
        $.ajax({
            url: $(this).attr('action'),
            type: $(this).attr('method'),
            data: $(this).serialize(),
            dataType: 'html',
            success: function(response) {
                target.html(response);
            }
        });
    });
    
  • Post a Comment for "Jquery - Loading Form Submission In Div Of Parent Page (?)"