Last active
December 27, 2015 10:59
-
-
Save fadomire/7315744 to your computer and use it in GitHub Desktop.
Form to Object
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
var arr = $('#myForm').serializeArray(); | |
var data = _(arr).reduce(function(acc, field) { | |
acc[field.name] = field.value; | |
return acc; | |
}, {}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For a multi-dimensional form check https://github.com/serbanghita/formToObject.js