How do I collect all the checkboxes and dropdown list items in jQuery for saving?
Asked
Active
Viewed 1.0k times
7
-
*Large correlation* between the questions - http://stackoverflow.com/a/1186309/11236 – ripper234 Nov 28 '11 at 14:35
3 Answers
10
Or, for recent versions of jquery you can use:
http://docs.jquery.com/Ajax/serialize - to a URL encoded string person.name=john&person.age=20
or
3
One way is to use the jQuery Form plugin, like this:
$('#myFormId').formSerialize();
From the formSerialize API documentation:
Serializes the form into a query string. This method will return a string in the format: name1=value1&name2=value2

karim79
- 339,989
- 67
- 413
- 406
2
$('#myFormId').formSerialize(); is a plugin and maybe not necessary. The core function serialize() is better.

Elzo Valugi
- 27,240
- 15
- 95
- 114