在我的表单成功时,我调用了一个名为“onReSuccessFunction()”的函数。在该函数中,我有一个表单提交代码。但在完成表单提交之前,下一行代码被执行并重定向到另一个页面。因此第一个功能检查不起作用。有人有解决此问题的想法吗?
代码
@using (@Ajax.BeginForm("ActionEvent", "Energy", new AjaxOptions { OnSuccess = "onReSuccessFunction", HttpMethod = "post",async ="false"}, new { id = "frmEnergy", enctype = "multipart/form-data", target = "ifrReFileUpload" }))
{
@Html.Partial("../Energy/_CreateOrEdit", Model)
}
function onReSuccessFunction(result) {
if (chekHaveAnyFileUpload("#divReUploadDocument")) {
document.getElementById("frmEnergy").submit();
}
if (result.Energy.TransStatus == "2") {
if (moveToNextTab(1) == false) {
window.location.href = "../../folio/Index";
}
}
}