function submitForm(){
$('#form1').ajaxSubmit(ajaxOptionsNew);
}
var ajaxOptionsNew = {
beforeSubmit : fn_check_form,
success : showResponse,
url : "costAtion!save2.action",
error : function(XMLResponse) {
alert(XMLResponse.responseText);
alert('操作失败!');
// window.location.reload();
}
};
function fn_check_form(){
if($("#Name").val() == ""){
alert("人不能为空");
$("#Name").focus();
return false;
}
}
function showResponse(responseText) {
try{
//alert(responseText);
if(responseText == 'true'){
alert('操作成功!');
window.location.reload();
}
else if(responseText == 'paramFalse')
{
alert("必填参数不能为空!")
}
else if(responseText == 'timeError')
{
alert("出发时间不能大于报销时间!");
}
else{
alert('操作失败!');
// window.location.reload();
}
}catch(e){alert(e.message);}
}