Back
How to convert form data to JavaScript object with jQuery
You can try something like this:
function objectifyForm(formArray) { //serialize data function var returnArray = {}; for (var i = 0; i < formArray.length; i++){ returnArray[formArray[i]['name']] = formArray[i]['value']; } return returnArray;}
function objectifyForm(formArray) {
//serialize data function
var returnArray = {};
for (var i = 0; i < formArray.length; i++){
returnArray[formArray[i]['name']] = formArray[i]['value'];
}
return returnArray;
Interested in full-stack development? Check out the full-stack developer course from Intellipaat.
31k questions
32.8k answers
501 comments
693 users