Skip to content

Instantly share code, notes, and snippets.

@ryoppy
Created July 17, 2013 22:51
Show Gist options
  • Save ryoppy/6025254 to your computer and use it in GitHub Desktop.
Save ryoppy/6025254 to your computer and use it in GitHub Desktop.
serializeArrayをname:valueのオブジェクトに変換 ref: http://qiita.com/ryoppy@github/items/0ceb0c19b92da34c7ce1
/**
* $formのデータをkey:valueで取得
* @param {jQuery} $form
* @return {Object} {name: "value", ...}
*/
getValues: function($form) {
return _.chain($form.serializeArray())
.map(function(obj) { return [obj.name, obj.value] })
.object()
.value();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment