submitting multiple forms with AJAX

前端 未结 1 732
伪装坚强ぢ
伪装坚强ぢ 2020-12-02 00:53

I have a page which contains several forms. I want to add a single submission button that will allow all the forms to be saved at the same time, as illustrated below:

<
相关标签:
1条回答
  • 2020-12-02 01:25

    This should submit each form via ajax without having to map the fields yourself:

    $('form').each(function() {
        var that = $(this);
        $.post(that.attr('action'), that.serialize());
    });
    
    0 讨论(0)
提交回复
热议问题