Created
April 6, 2011 13:54
-
-
Save thinkt4nk/905677 to your computer and use it in GitHub Desktop.
Serialize an object from jquery serialized array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This function is very useful. Thank you very much.