Last active
May 31, 2018 16:22
-
-
Save smartdeal/3e6824646729948f4a96165a2956f278 to your computer and use it in GitHub Desktop.
[Form data to array] Prepare form's data for send to server by AJAX #jQuery #Ajax
This file contains hidden or 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
function getFormData($form){ | |
var unindexed_array = $form.serializeArray(); | |
var indexed_array = {}; | |
$.map(unindexed_array, function(n, i){ | |
indexed_array[n['name']] = n['value']; | |
}); | |
return indexed_array; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment