Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Web Technology by (7k points)

How to convert form data to JavaScript object with jQuery

1 Answer

0 votes
by (13.1k points)

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;

}

Interested in full-stack development? Check out the full-stack developer course from Intellipaat.

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Aug 13, 2019 in Web Technology by Sammy (47.6k points)
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...