📜  jquery 序列化 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:26.594000             🧑  作者: Mango

代码示例3
$.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;
};