- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 Ajax 表单,每当我向任何 AjaxOptions 属性提供回调方法时,我都会收到此错误。
Microsoft JScript runtime error: Object doesn't support this property or method
如果我不向任何属性(OnSuccess、OnFailure、OnComplete 或 OnBegin)提供回调函数,则不会发生错误并且表单会正确发布。
这是我的代码。
<% using (Ajax.BeginForm("someAction", "SomeController", new AjaxOptions() {
HttpMethod="POST",
UpdateTargetId = "feedbackMsg",
OnSuccess = "ShowConfirmationMessage"
}))
{ %>
我的 JavaScript 代码是这样的。
函数 ShowConfirmationMessage(xhr) {
警报(xhr);}
当我提供 OnSuccess 方法时,代码会像这样呈现。
<form action="/Review/SaveQualityScore"
method="post"
onclick="Sys.Mvc.AsyncForm.handleClick(this, new Sys.UI.DomEvent(event));"
onsubmit="Sys.Mvc.AsyncForm.handleSubmit(this, new Sys.UI.DomEvent(event),
{
insertionMode: Sys.Mvc.InsertionMode.replace,
httpMethod: 'POST',
updateTargetId: 'feedbackMsg',
onSuccess: Function.createDelegate(this, ShowConfirmationMessage)
});"
>
我猜测 Function.createDelegate 是问题所在。因为当我删除 OnSuccess 属性时, function.CreateDelegate 不会被渲染,并且一切正常。
无论如何,我在这里快要疯了,任何帮助将不胜感激。谢谢!
最佳答案
确保包含以下脚本:
关于javascript - 为 OnSuccess、OnFailure、OnComplete 和 OnBegin 提供回调参数时使用 Ajax.BeginForm 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6347784/
也许这是一个愚蠢的问题,但我还没有找到它......但是。 我在 MVC 中有一个带有 Ajax.BeginForm 的 View 。该模型有一个属性值(字符串)。这是 View 的一部分: @usi
如何从 OnBegin 函数中引用被点击的 Ajax.ActionLink? cshtml @Ajax.ActionLink( typeName, "OrderQueueRows",
我的应用程序中有一个 Ajax 表单。我想将事件传递给 OnBegin 函数,然后使用 event.preventdefault() 来阻止表单提交然后在检查一些条件后,我尝试手动提交表单。但它不起作
我正在使用 SignaturePad。 ( https://github.com/szimek/signature_pad ) 根据 API,onBegin() 在笔划开始时被调用,但它似乎只在页面加
无论我尝试什么,没有一个 JavaScript 方法不能触发/工作。 [HttpPost] public JsonResult Errors (string name, string email) {
问题:此代码未触发 StartValidation 函数。为什么? $(document).ready(function () { $(
我在我的 MVC 应用程序中使用 Ajax.BeginForm 助手。这是一个简化的示例: 问题是,如果 OnBegin 回调返回 false,这会正确地阻止进行 ajax 调用,加载元素“
On end test 你可以试试这个代码here 它看起来 onbegin 事件在 IOS 设备上不起作用,这里有人知道吗? 最佳答案 @Reber
使用 MVC3、C# 和 Razor View 引擎:我有一个带有 Ajax Action 链接的表单。在我尝试指定 OnBegin 和 OnComplete javascript 函数调用的选项中。
我在我的 MVC 3 + Razor 应用程序中使用 Ajax.Begin 表单 using (Ajax.BeginForm("ActionName", "ControllerName", n
我的 Controller 创建一个这样的链接列表 @foreach (var item in Model.MenuItems) { @Ajax.ActionLink(item.Captio
我正在使用 jQuery UI 对话框。我有一个删除表单如下: @using (Ajax.BeginForm("DeleteUser", "Administrator", new { id = Mod
可以修改 ajax.beginform 的 onbegin 上发布的输入值吗?提交表单后,我必须修改某些输入字段的值。但即使我通过 js 更改值,在 request.form 的服务器端我也会得到在表
在 MVC3 应用程序中,我有一个 View 呈现两个 Ajax 分部 View :创建分部 View 和 ListView 。在创建部分 View 中,我尝试在 OnBegin 事件上触发客户端验证
我有以下ajax.actionlink:- @Ajax.ActionLink("Delete", "Delete", "Answer", new { id = answer.AnswersID
我在 ASP.NET MVC 5 中工作。我在使用 Ajax.BeginForm 提交表单期间显示加载程序: @using (Ajax.BeginForm("Filter", "Log", new A
编辑:更清楚地说,我希望 onBegin 调用一个从 Ajax 调用返回 true 或 false 值的函数。该 false 值需要能够触发 onBegin 来中止表单提交,就像我从非 ajax 函数
我正在尝试使用 Ajax 表单,每当我向任何 AjaxOptions 属性提供回调方法时,我都会收到此错误。 Microsoft JScript runtime error: Object doesn
jQuery 表单验证器与 Html.Beginform 配合良好。 我将 Html.Beginform 更改为 Ajax.Beginform,以便在不刷新的情况下提交表单(尝试过 Ajax post
我有一个 Ajax Action 链接,它会调用一个 action 方法, 在我的 Ajax 选项中,我调用了一个验证函数, 如果这个函数返回真, 那么只有我想要执行此操作,不知道如何完成此操作? 我
我是一名优秀的程序员,十分优秀!