标签:style class blog code http tar
$.fn.serializeObject = function () { var obj = {}; var count = 0; $.each(this.serializeArray(), function (i, o) { var n = o.name, v = o.value; count++; obj[n] = obj[n] === undefined ? v : $.isArray(obj[n]) ? obj[n].concat(v) : [obj[n], v]; }); //obj.nameCounts = count + "";//表单name个数 return JSON.stringify(obj); }; 调用示例:var serStr = $(‘#form1‘).serializeObject();
jquery将表单序列化json对象,布布扣,bubuko.com
标签:style class blog code http tar
原文地址:http://www.cnblogs.com/yeminglong/p/3799282.html