Skip to content

Instantly share code, notes, and snippets.

@MohamedLamineAllal
Last active November 19, 2018 00:04
Show Gist options
  • Save MohamedLamineAllal/7a2684b02569b50e9138d8c72d2fe3ce to your computer and use it in GitHub Desktop.
Save MohamedLamineAllal/7a2684b02569b50e9138d8c72d2fe3ce to your computer and use it in GitHub Desktop.
turn array data from serializeArray() jquery method to object format
function formArrayToObject(formArray) {//serialize 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