Skip to content

Instantly share code, notes, and snippets.

@joseph-tran-tn
Created June 6, 2018 22:56
Show Gist options
  • Save joseph-tran-tn/69bd333670a354b891becf8ae753df1b to your computer and use it in GitHub Desktop.
Save joseph-tran-tn/69bd333670a354b891becf8ae753df1b to your computer and use it in GitHub Desktop.
Convert form data to JavaScript object with jQuery Ask Question
function objectifyForm(formArray) { //serializeArray data function
var returnArray = {};
for (var i = 0; i < formArray.length; i++){
returnArray[formArray[i]['name']] = formArray[i]['value'];
}
return returnArray;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment