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("必填參數(shù)不能為空!")
}
else if(responseText == 'timeError')
{
alert("出發(fā)時(shí)間不能大于報(bào)銷時(shí)間!");
}
else{
alert('操作失敗!');
// window.location.reload();
}
}catch(e){alert(e.message);}
}