将form表单元素的值序列化成对象

 1 /**jQuery
 2  * 将form表单元素的值序列化成对象
 3  * @returns object
 4  */
 5 var serializeObject = function(form) {
 6    var o = {};
 7    $.each(form.serializeArray(), function(index) {
 8       if (o[this['name']]) {
 9          o[this['name']] = o[this['name']] + "," + this['value'];
10       } else {
11          o[this['name']] = this['value'];
12       }
13    });
14    return o;
15 };
原文地址:https://www.cnblogs.com/LingCoder/p/9816424.html