1 统一适用代码
//序列化表单 $.fn.serializeObject = function() { var object = {}; var a = this.serializeArray(); $.each(a, function() { if (object[this.name]) { if (!object[this.name].push) { object[this.name] = [ object[this.name] ]; } object[this.name].push(this.value || ''); } else { object[this.name] = this.value || ''; } }); return object; };