提交后 Ajax.BeginForm OnSuccess 未执行
我正在尝试使用 jquery 对话框来编辑 WebGrid 中的数据。在提交表单之前,一切都工作正常,浏览器不会返回到打开的当前页面,而是会转到控制器操作的 url。我在 WebGrid 中使用 HTML.ActionLink 将 jquery 行为添加到 WebGrid 的按钮,并且效果很好。它在 jquery 对话框中打开视图。该对话框定义了两个按钮:更新按钮和取消按钮。单击取消按钮不会执行任何操作。单击更新按钮会将浏览器带到控制器 URL,以使用项目 ID 进行编辑操作。我定义了 jquery.unobtrusive-ajax.js 库,并在 Web.config 文件中添加了 UnobtrusiveJavaScriptEnabled 键,尽管我不确定是否需要它。有谁经历过这种行为,非常感谢任何帮助!
I am trying to use a jquery dialog to edit data in an WebGrid. Everythings works fine until the Form is submitted, instead of return to the current page that is open the browser goes to the url of the controller action. I am using an HTML.ActionLink in the WebGrid that adds jquery behavior to a button the WebGrid, and that works fine. It opens the View in a jquery dialog. The dialog defines two buttons: an update button and a cancel button. Clicking the cancel button does nothing. Clicking the update button takes the browser to the controller url for the edit action with the item id. I have the jquery.unobtrusive-ajax.js library defined and I added the UnobtrusiveJavaScriptEnabled key in the Web.config file, although I am not sure it's needed. Has anyone experienced this behavior, any help is appreicated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我在两种情况下遇到过这个问题:
绑定到表单的提交事件,或者它没有抑制默认行为(通过
event.preventDefault();
或return false;
)。处理程序,导致它回落到
默认行为。
好吧,这就是我在没有任何来源的情况下可以尽力提供的帮助。
I've experienced this problem in two situations:
binded to the form's submit event, or it was not suppressing the default behavior (through
event.preventDefault();
orreturn false;
).handler, causing it to fall back to the
default behavior.
Well this is how much I can try to help without any source.
当我遇到这个问题时,我没有引用 jquery-Ajax.unobtrusive 库,因此请确保它也在那里
从我的条目 http://completedevelopment.blogspot.com/2011/02/unobstrusive-javascript-in-mvc-3-helps.html
When I had this issue I wasnt referencing the jquery-Ajax.unobtrusive library so ensure that's there too
From my entry at http://completedevelopment.blogspot.com/2011/02/unobstrusive-javascript-in-mvc-3-helps.html