本文介绍了单击确定后,jQuery警报消息框重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用ASP.NET MVC 4,因此如何在单击确定"后将消息框重定向到索引页?
I am using ASP.NET MVC 4, so how do I redirect the message box upon click ok back to index page?
这是我的代码
<script type="text/javascript">
$(function errMsgBox() {
alert("Please select the Correct Activity and Task");
@Html.ActionLink("Back to List", "/Index")
});
</script>
推荐答案
您不再需要在这里使用剃刀.只需使用window.location对象即可.
You don't need to use razor here anymore. Just use the window.location object.
<script type="text/javascript">
$(function errMsgBox() {
alert("Please select the Correct Activity and Task");
window.location = "/Home/Index";
});
</script>
这篇关于单击确定后,jQuery警报消息框重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!