1.ajax使用serialize()序列化提交单个表单
<span style="font-size:18px;"> $.ajax(
'fk/register/add',{
type:'post',
dataType:'json',
data:$("#visitor_form").serialize(),
success:function(data){
},
error:function(response){
},
complete:function(){
}
});</span>
2.ajax提交表单和其它单数据
<span style="font-size:18px;"> var data = $.extend({suiteList:suiteList},$("#visitor_form").serializeObject());
$.ajax(
'fk/register/add',{
type:'post',
dataType:'json',
data:data,
success:function(data){
},
error:function(response){
},
complete:function(){
}
});</span>
3.ajax提交多表单
<span style="font-size:18px;"> var data = $.extend($("#form_id").serializeObject,$("#visitor_form").serializeObject());
$.ajax(
'fk/register/add',{
type:'post',
dataType:'json',
data:data,
success:function(data){
},
error:function(response){
},
complete:function(){
}
});</span>