I have forms in loop that are created dynamically , and I need to submit all of them with one click, i am following the code below. Can you please suggest me how can I do this
You can iterate through all the forms with the given name and submit one by one
$(document).ready(function () {
$("#submitButton").click(function () {
var $form1 = $("#form1");
$.post($form1.attr("action"), $form1.serialize(), function () {
alert('Form 1 submitted');
});
$('form[name="formsub"]').each(function () {
var $form = $(this);
$.post($form.attr("action"), $form.serialize(), function () {
alert('Form 2 submitted');
});
})
});
});