Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $.fn.serializeObject = function ()
  2. {
  3.     var o = {};
  4.     var a = this.serializeArray();
  5.     $.each(a, function () {
  6.         if (o[this.name] !== undefined) {
  7.             if (!o[this.name].push) {
  8.                 o[this.name] = [o[this.name]];
  9.             }
  10.             o[this.name].push(this.value || '');
  11.         } else {
  12.             o[this.name] = this.value || '';
  13.         }
  14.     });
  15.     return o;
  16. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement