jQuery ajax - serialize() 表单传值
来源:互联网 发布:网络推广员面试问什么 编辑:程序博客网 时间:2024/06/05 11:23
jQuery ajax - serialize() 方法
定义和用法
serialize() 方法通过序列化表单值,创建 URL 编码文本字符串。
您可以选择一个或多个表单元素(比如 input 及/或 文本框),或者 form 元素本身。
序列化的值可在生成 AJAX 请求时用于 URL 查询字符串中。
输出 a=1&b=2&c=3&d=4&e=5 后台request.getParameter("a")就能获取到value
定义和用法
serialize() 方法通过序列化表单值,创建 URL 编码文本字符串。
您可以选择一个或多个表单元素(比如 input 及/或 文本框),或者 form 元素本身。
序列化的值可在生成 AJAX 请求时用于 URL 查询字符串中。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<form>
<div><input type=
"text"
name=
"a"
value=
"1"
id=
"a"
/></div>
<div><input type=
"text"
name=
"b"
value=
"2"
id=
"b"
/></div>
<div><input type=
"hidden"
name=
"c"
value=
"3"
id=
"c"
/></div>
<div>
<textarea name=
"d"
rows=
"8"
cols=
"40"
>4</textarea>
</div>
<div><select name=
"e"
>
<option value=
"5"
selected=
"selected"
>5</option>
<option value=
"6"
>6</option>
<option value=
"7"
>7</option>
</select></div>
<div>
<input type=
"checkbox"
name=
"f"
value=
"8"
id=
"f"
/>
</div>
<div>
<input type=
"submit"
name=
"g"
value=
"Submit"
id=
"g"
/>
</div>
</form>
$(
'form'
).submit(
function
() {
alert($(
this
).serialize());
return
false
;
});
输出 a=1&b=2&c=3&d=4&e=5 后台request.getParameter("a")就能获取到value
0 0
- jQuery ajax - serialize() 表单传值
- jQuery ajax - serialize() 方法提交表单
- ajax提交form表单 jQuery ajax - serialize() 方法
- jQuery ajax中form.serialize() 方法-输出序列化表单值
- jQuery Ajax传递整个表单的数据方法:.serialize()
- jQuery ajax中使用serialize() 方法提交表单数据
- jQuery ajax中使用serialize() 方法提交表单数据
- jQuery ajax中使用serialize()方法提交表单数据
- Jquery:使用$.ajax()和serialize()函数来实现表单提交
- jQuery ajax中使用serialize()方法提交表单数据
- jQuery ajax中使用serialize() 方法提交表单数据
- jQuery ajax中使用serialize() 方法提交表单数据
- jquery获取表单值的利器:serialize()
- jQuery ajax - serialize() 方法
- jQuery ajax - serialize()
- jQuery ajax - serialize() 方法
- jQuery ajax - serialize() 方法
- jQuery ajax - serialize() 方法
- TeraSort实验--测试Map和Reduce Task数量对Hadoop性能的影响
- B. Inna and New Matrix of Candies
- malloc/free与new/delete的相同点和不同点
- jsp 引入 jstl标签库报 can not find the liblary 问题
- 近期算法和数据结构面试题解答汇总(更新)
- jQuery ajax - serialize() 表单传值
- window.showModalDialog();会弹出当前页面脚本发生错误部分解决方法
- R 语言文件操作
- JSON 转换成Java对象的方法
- Thinking in Java 泛型
- 三角形类
- USACO Runaround Numbers
- mysql (master/slave)复制原理及配置
- java 向 mysql 插入汉字 Incorrect string value 解决办法