![](/img/trans.png)
[英]How to redirect two step backward after clicking delete button in asp.net and vb.net
[英]Need jQuery method to redirect after button click - ASP.NET, VB.NET, jQuery, Javascript
我的一个ASP.NET应用程序(VB)中有一个页面依赖于实时的第三方服务,如果发现该服务已关闭,我正在使用jQuery显示覆盖。 我一直在应用程序中对其他警告使用相同的方法-与此不同的是,用户单击警告弹出窗口上的按钮以删除覆盖后,需要重定向。 我尝试了许多不同的方法,但是在所有情况下,重定向操作都是在覆盖警告甚至不可见之前发生的。 我理解为什么,我只是找不到解决方案来解决它。 非常感谢您的协助! 我正在使用以下代码:
jQuery的
function warn_redirect(msg, title, nextpage) {
// show modal div
//alert(obj.id);
$("html").css("overflow", "hidden");
$("body").append("<div id='popup_overlay'></div><div id='popup_window'></div>");
$("#popup_overlay").addClass("popup_overlayBG");
$("#popup_overlay").fadeIn("slow");
// build warning box
$("#popup_window").append("<h1>" + title + "</h1>");
$("#popup_window").append("<p id='popup_message'><center>" + msg + "</center></p>");
$("#popup_window").append("<div class='buttons'><center><button id='continue' class='positive' type='submit'>OK</button></center></div>");
// attach action to button
$("#continue").click(popup_remove_redirect(nextpage));
// display warning window
popup_position(400, 300);
$("#popup_window").css({ display: "block" }); //for safari using css instead of show
$("#continue").focus();
$("#continue").blur();
}
function popup_remove_redirect(nextpage) {
$("#popup_window").fadeOut("fast", function () { $('#popup_window,#popup_overlay').trigger("unload").unbind().remove(); });
$("body", "html").css({ height: "auto", width: "auto" });
$("html").css("overflow", "");
window.location.href = nextpage;
}
(我将window.location.href添加到我的标准弹出窗口删除代码中,但是我尝试了其他方法,包括通过单击按钮触发两个操作。)
这是VB.NET调用代码:
If Status = "DOWN" Then
Dim clsUtility As New Utility
clsUtility.Emailer("email@company.com", "email@company.com", "", "", "The Service Is Down!", "Please investigate")
Dim ScriptString As String = "<script language='javascript'>"
ScriptString += "warn_redirect('Some warning message.', 'Warning', 'AnotherPage.aspx');"
ScriptString += "</script>"
ClientScript.RegisterStartupScript(Me.GetType, "warnscript", ScriptString)
'Response.Redirect("AnotherPage.aspx?ID=" & Session("SelKey") & "&UN=" & Header1.UserNumber) //this didn't work either
End If
您将在此处立即调用函数:
$("#continue").click(popup_remove_redirect(nextpage));
您想做:
$("#continue").click(function() { popup_remove_redirect(nextpage); });
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.