开发者

jquery form not submitting

开发者 https://www.devze.com 2022-12-17 12:36 出处:网络
For some reason everything works with my code but the form will not submit. $(function(){ $(\"#dialog\").dialog({

For some reason everything works with my code but the form will not submit.

$(function(){

            $("#dialog").dialog({
                    autoOpen:false,
                    bgiframe: true,
                    resizable: false,
                    //height:auto,
                    width:500,
                    modal: true,
                    overlay: {
                        backgroundColor: '#000',
                        opacity: 0.5
                    },
                    buttons: {
                        'I Agree': function() {
                            $(this).dialog('close');
                            $('#form1').submit()                    

                        },
                   开发者_StackOverflow中文版     'I Do Not Agree': function() {
                            $(this).dialog('close');
                            return false;
                        }
                    }
                });

            $("#submit").click(function(){

                $("#dialog").dialog('open');


            });
        });


Turns out I needed my button outside of the form tag.


I'd guess (you haven't shown the HTML) that the form contains a form control with the name or id submit which clobbers the submit method of the form.

The easiest solution is to rename the control, otherwise see How to reliably submit an HTML form with JavaScript?


Is that a copy/paste of your code? Because you're actually missing a semicolon at the end of the $('#form1').submit().

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号