日期:2014-05-16 浏览次数:20699 次
$("#submitButton").click(function(){ //序列化表单 var param = $("#leaveSave").serialize(); $.ajax({ url : "leaveSave.action", type : "post", dataType : "json", data: param, success : function(result) { if(result=='success') { location.href='allRequisitionList.action'; } else if(result.startWith("error_")){ $("#errorMessage").html(result.substring(6)); } else { //返回的结果转换成JSON数据 var jsonObj = eval('('+result+')'); startTime = $("#startdate").val(); endTime = $("#enddate").val(); hour = jsonObj.hour; reason = jsonObj.reason; replaceDom(startTime,endTime,hour,reason); } } }); });
$("#saveWorkExtra").validate({ onsubmit:true,// 是否在提交是验证 onfocusout:false,// 是否在获取焦点时验证 onkeyup :false,// 是否在敲击键盘时验证 rules: { .... }, messages:{ .... }, submitHandler: function(form) { //通过之后回调 var param = $("#saveToWorkExtra").serialize(); $.ajax({ url : "workExtraChange.action", type : "post", dataType : "json", data: param, success : function(result) { if(result=='success') { location.href='allRequisitionList.action'; } else { var jsonObj = eval('('+result+')'); } } }); }, invalidHandler: function(form, validator) { //不通过回调 return false; } });