在jQuery中收集表单中的所有项目
如何收集jQuery中的所有复选框和下拉列表项以进行保存?
或者,对于最新版本的jquery,您可以使用:
http://docs.jquery.com/Ajax/serialize – 到URL编码的字符串person.name=john&person.age=20
要么
一种方法是使用jQuery Form插件,如下所示:
$('#myFormId').formSerialize();
从formSerialize API文档 :
Serializes the form into a query string. This method will return a string in the format: name1=value1&name2=value2
$( ‘#myFormId’)formSerialize()。 是一个插件,可能没有必要。 核心函数serialize()更好。