Skip to content

Instantly share code, notes, and snippets.

@thinkt4nk
Created April 6, 2011 13:54
Show Gist options
  • Save thinkt4nk/905677 to your computer and use it in GitHub Desktop.
Save thinkt4nk/905677 to your computer and use it in GitHub Desktop.
Serialize an object from jquery serialized array
$.fn.serializeToObject = function() {
var serial_array = this.serializeArray();
var serial_object = {};
$(serial_array).each(function() {
if( !serial_object[this.name] )
{
serial_object[this.name] = this.value;
}
});
return serial_object;
}
@toitx-sudobo
Copy link

This function is very useful. Thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment