关于使用jquery form submit出现多次提交的问题

错误的写法:

$(this).submit(function () {
                    $(this).ajaxSubmit({
                        url: opts.url,
                        type: 'post',
                        dataType: 'json',
                        beforeSubmit: function () {
                            opts.beforeSubmit();
                        },
                        success: function (result) {
                            opts.success(result);
                        }
                    });
                    return false;
                }).submit();

 

下面是正确的写法:

$(this).ajaxSubmit({
                    url: opts.url,
                    type: 'post',
                    dataType: 'json',
                    beforeSubmit: function () {
                        opts.beforeSubmit();
                    },
                    success: function (result) {
                        opts.success(result);
                    }
                });
                return false;

去掉了外层的Jquery的submit提交。

posted @ 2015-05-14 17:33  魏巍(QQ:68235081)  阅读(2307)  评论(0编辑  收藏  举报