Twitter Bootstrap Modal Form Submit

后端 未结 5 673
鱼传尺愫
鱼传尺愫 2020-12-05 03:29

I\'ve recently been fiddling around with twitter bootstrap, using java/jboss, and i\'ve been attempting to submit a form from a Modal interface, the form contains just a hid

5条回答
  •  青春惊慌失措
    2020-12-05 03:48

    This answer is late, but I'm posting anyway hoping it will help someone. Like you, I also had difficulty submitting a form that was outside my bootstrap modal, and I didn't want to use ajax because I wanted a whole new page to load, not just part of the current page. After much trial and error here's the jQuery that worked for me:

    $(function () {
        $('body').on('click', '.odom-submit', function (e) {
            $(this.form).submit();
            $('#myModal').modal('hide');
        });
    });
    

    To make this work I did this in the modal footer

    
    

    Notice the addition to class of odom-submit. You can, of course, name it whatever suits your particular situation.

提交回复
热议问题