How to submit a specific form if multiple forms are present in one page using jquery

后端 未结 6 2089
-上瘾入骨i
-上瘾入骨i 2021-02-14 09:49

I have two forms.

6条回答
  •  误落风尘
    2021-02-14 10:23

    You can use ajax to submit the first form before the second one:

    $('form[name=frm2]').submit(function() {
        var form1 = $('form[name=frm1]');
        $.ajax({
            type: "POST",
            url: form1.attr('action'),
            data: form1.serialize(),
            async: false;
        });
    });
    

提交回复
热议问题