(function($){
$.fn.serializeJson=function(){
var serializeObj={};
var array=this.serializeArray();
var str=this.serialize();
$(array).each(function(){
if(serializeObj[this.name]){
if($.isArray(serializeObj[this.name])){
serializeObj[this.name].push(this.value);
}else{
serializeObj[this.name]=[serializeObj[this.name],this.value];
}
}else{
serializeObj[this.name]=this.value;
}
});
return serializeObj;
};
})(jQuery);//序列化多个表单
function formSumbit(formNumber) { //$("#loading").show(); debugger; var proRuestl_1 = $("#allOne").serializeJson();//数据序列化 var proRuestl_2= $("#allTwo").serializeJson();//数据序列化 var proRuestl_3= $("#"+formNumber).serializeJson();//数据序列化 var proRuestl_4= $("#allThree").serializeJson();//数据序列化 var param if(formNumber=='form1' || formNumber=='form2'){ param = $.extend({},proRuestl_1,proRuestl_2,proRuestl_3,proRuestl_4); var cityCode12 = $("#cityCode12").val(); if(cityCode12==""){alert("请选择城市!");return;} }else{ param = $.extend({},proRuestl_3); } jQuery.ajax({ url : '${ctx}/admin/preferentialHotel/insertSelective',data: param,type : "POST",dataType: "json",beforeSend : function() { $("#loading").show(); },success : function() { $("#loading").hide(); alert("保存成功!"); } }); }