📜  serializeobject jquery - Javascript 代码示例

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

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