表单序列化数组相同转JSON 发表于 2018-02-23 | 分类于 js | 字数统计: | 阅读时长 ≈ 123456789101112131415$.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;}