Skip to content

Instantly share code, notes, and snippets.

@raineorshine
Created March 12, 2014 18:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raineorshine/9513200 to your computer and use it in GitHub Desktop.
Save raineorshine/9513200 to your computer and use it in GitHub Desktop.
Convert the results from jQuery's serializeArray to an object.
var formData = $('#myform').serializeArray();
_.merge.apply(_, formData.map(function(o) { var kvp={}; kvp[o.name] = o.value; return kvp; }))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment