How do you serialize a form in jQuery?

<form id="f"><input name="a" value="1"><input name="b" value="x y"></form>
console.log($('#f').serialize());
console.log($('#f').serializeArray());
Console output

a=1&b=x%20y
[ { name: 'a', value: '1' }, { name: 'b', value: 'x y' } ]

See jQuery Forms.


Learn more about the similar topics:
Tutorials
No Content Found.
Exercises & Assignments
No Content Found.
Interview Questions & Answers
No Content Found.