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
jQuery Forms
Exercises & Assignments
Write jQuery code to validate that a field is not empty before submit
Write jQuery code to show the remaining characters of a textarea
Write jQuery code for a “select all” checkbox
Write jQuery code to enable the submit button only when a checkbox is checked
Write jQuery code to copy the text of one field to another field
Interview Questions & Answers
How do you get the value of an input, checkbox and radio button in jQuery?
How do you serialize a form in jQuery?