jQuery ajax中使用serialize()方法提交表单数据示例
<form id="form"> 输入账号 :<input id="name" type="text" name="name"> <br> 输入年龄 :<input id="age" type="text" name="age"> <br> 输入手机号码 :<input id="mobile" type="text" name="mobile"> <br> </form>
jQuery ajax:
$.ajax({ type: "POST", url: ajaxCallUrl, data: "Key=Value&Key2=Value2", success: function(msg){alert(msg);} });
ajax serialize():
$.ajax({ type: "POST", url:ajaxUrl, data:$('#form').serialize(),// 要提交的表单 $("#formid").serialize()或者$(".form").serialize() success: function(msg) {alert(msg);} });