Guest User

Untitled

a guest
Jan 22nd, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. //autor: Tobias Cohen
  2. $.fn.serializeJSON = function(){
  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. };
Add Comment
Please, Sign In to add comment