0

How do i submit multiple forms in a single page using jQuery Form Plugin

http://malsup.com/jquery/form/

Normally for one form i use below code

$(document).ready(function() {
    $('#MyForm').on('submit', function(e) {
        e.preventDefault();
        $('#submitButton').attr('disabled', '');
        //show uploading message
        $("#output").html('Working.. Please wait..');

        $(this).ajaxSubmit({
            target: '#output',
            success: afterSuccess //call function after success
        });
    });
});
function afterSuccess() {
    $('#submitButton').removeAttr('disabled'); //enable submit button
}

And form HTML

<form id="MyForm" action="submit.php" method="post">

<--- Form elements -->

</form>

So if i have unlimited number of forms with different id's MyForm_1, MyForm_2, MyForm_3 etc. how can i use form plugin to submit them?

rrk
  • 15,677
  • 4
  • 29
  • 45
max
  • 331
  • 1
  • 3
  • 11

0 Answers0