Ajax.BeginForm升级到MVC 3和.NET 4后有异常表现 [英] Ajax.BeginForm acting strangely after upgrading to MVC 3 and .NET 4

查看:117
本文介绍了Ajax.BeginForm升级到MVC 3和.NET 4后有异常表现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在asp.net MVC2就好几个月使用Ajax.form。现在我升级我的应用程序MVC3和.net 4,发布我的Ajax表单时
我从浏览器对话框试图下载的JSON结果。

I have been using Ajax.form in asp.net mvc2 just fine for months. I upgraded my application to MVC3 and .net 4 and now, when posting my ajax form I get a dialog from the browser trying to download the json result.

这是我的形式

    <%using (Ajax.BeginForm("MyAction", "MyController", new AjaxOptions { UpdateTargetId = "status" })) ....

这里是回归说明书在我的控制器

here is the return statment in my controller

....
string result = "Update Successfull";
var jsonresult = result;
        return Json(jsonresult, JsonRequestBehavior.AllowGet);

确实MVC3处理Ajax形式不同于MVC2?

does MVC3 handle ajax forms differently than mvc2?

推荐答案

ASP.NET MVC 3使用jQuery,而不是MSAjax。所以,你可能需要包括这个工作jQuery的不显眼的AJAX脚本。您可能还签这个博客帖子

ASP.NET MVC 3 uses jquery instead of MSAjax. So you might need to include the jquery unobtrusive ajax script for this to work. You also might checkout this blog post.

这篇关于Ajax.BeginForm升级到MVC 3和.NET 4后有异常表现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆