本文介绍了AjaxOptions.confirm不ActionLink的或BeginForm提交弹出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个新的,所以忍耐一下,如果我错过了这个地方的另一个答案。我试着在Ajax.BeginForm使用AjaxOptions并没有弹出,所以我切换到在ActionLink的测试它,而是和仍然无法得到它的工作。对于ajax.beginform和ajax.actionlink都不言而喻了正确的控制器,并进行罚款,但我没有得到任何确认消息。

我是什么做错了吗?

谢谢,
氏/ P>

从视图中:

 <脚本类型=文/ JavaScript的SRC =/脚本/ jquery.unobtrusive-ajax.min.js>< / SCRIPT>@ Ajax.ActionLink(
撤销访问所有的画廊立即,
ViewInvites
画廊,
新AjaxOptions {
    确认=您确定要撤销访问所有的画廊?这不能被撤销。
    列举HTTPMethod =邮报
}


解决方案

确保script标签实际上是指向正确的脚本。您可能需要指定一个相对路径。

 < SCRIPT SRC =../脚本/ jquery.unobtrusive-ajax.min.js类型=文/ JavaScript的>< / SCRIPT>

Firebug是为发现,如果这是问题的帮助。

New to this, so bear with me if I missed this somewhere in another answer. I tried using AjaxOptions in Ajax.BeginForm and it did not pop up, so I switched to testing it in an ActionLink instead, and still can't get it to work. For both the ajax.beginform and the ajax.actionlink it goes to the correct controller and carries on fine, but I get no confirmation message.

What am I doing wrong?

Thanks,K

From View:

<script type="text/javascript" src="/Scripts/jquery.unobtrusive-ajax.min.js"></script>

@Ajax.ActionLink(
"Revoke Access to all Galleries Immediately", 
"ViewInvites", 
"Gallery", 
new AjaxOptions { 
    Confirm = "Are you sure you want to revoke access to all galleries? This cannot be undone.",
    HttpMethod = "Post"
}
)
解决方案

Be sure the script tag is actually pointing to the correct script. You may need to specify a relative path.

 <script src="../Scripts/jquery.unobtrusive-ajax.min.js" type="text/javascript" ></script>

Firebug is helpful for discovering if this is the issue.

这篇关于AjaxOptions.confirm不ActionLink的或BeginForm提交弹出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-14 19:20