Skip to content

Instantly share code, notes, and snippets.

@eltiare
Last active December 20, 2015 22:38
Show Gist options
  • Save eltiare/6206150 to your computer and use it in GitHub Desktop.
Save eltiare/6206150 to your computer and use it in GitHub Desktop.
An object serializer for jQuery. I don't know why this isn't already a thing...
(function($) {
$.fn.serializeObject = function() {
var arr = this.serializeArray(), a, ret = {};
$.each(arr, function(i, a) { ret[a.name] = a.value; });
return ret;
}
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment