$("#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); } } }); });
Validator验证Ajax提交表单的方法,布布扣,bubuko.com
原文:http://www.cnblogs.com/peterpanzsy/p/3584335.html