1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
$.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;
};

пример работы

источник: css-tricks.com

Оставьте свой комментарий