blockUI 错误“对象不支持此属性或方法”
我在 VS2010 中运行它,提交表单时出现错误,显示“Microsoft JScript 运行时错误:对象不支持此属性或方法”。有什么建议吗?
<script type="text/javascript">
function BlockUI() {
$.blockUI({ message: "<h1>Remote call in progress...</h1>" });
}
</script>
@using (Ajax.BeginForm("Switch", new AjaxOptions() {
UpdateTargetId = "Switch" + Model.Id,
InsertionMode = InsertionMode.Replace,
OnSuccess = "",
OnBegin = "BlockUI()",
OnComplete = "",
OnFailure = "alert('Failed to update switch')",
Confirm = "",
HttpMethod = "POST",
LoadingElementId = "",
Url = ""
}))
I'm running this from within VS2010 and an error comes up when the form is submitted which says "Microsoft JScript runtime error: Object doesn't support this property or method". Any suggestions?
<script type="text/javascript">
function BlockUI() {
$.blockUI({ message: "<h1>Remote call in progress...</h1>" });
}
</script>
@using (Ajax.BeginForm("Switch", new AjaxOptions() {
UpdateTargetId = "Switch" + Model.Id,
InsertionMode = InsertionMode.Replace,
OnSuccess = "",
OnBegin = "BlockUI()",
OnComplete = "",
OnFailure = "alert('Failed to update switch')",
Confirm = "",
HttpMethod = "POST",
LoadingElementId = "",
Url = ""
}))
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该更改
为
根据 MSDN
OnBegin
需要:附加的
()
可能会使底层 JavaScript 立即执行该函数,从而导致错误。类似地,对于
OnFailure
:此外,您不需要指定未使用的
AjaxOptions
的属性值:You should change
to
According to MSDN
OnBegin
takes:The additional
()
probably makes the underlying JavaScript execute the function immediately, causing the error.Similarly, with
OnFailure
:Also, you don't need to specify property values of
AjaxOptions
that you aren't using: