根据id获得form表单值$("#form1").serializeObject()方法未找到解决办法

在全局js添加如下代码:

$.fn.serializeObject = function() {
            var o = {};
            var a = this.serializeArray();
            $.each(a, function() {
                if (o[this.name]) {
                    if (!o[this.name].push) {
                        o[this.name] = [ o[this.name] ];
                    }
                    o[this.name].push(this.value || '');
                } else {
                    o[this.name] = this.value || '';
                }
            });
            return o;
        };

猜你喜欢

转载自blog.csdn.net/qq_36688143/article/details/79807073