mvc5 html.beginform,c# - MVC5 Ajax.BeginForm refresh whole page - Stack Overflow

This really tripped me up, and in searching for a solution - 99% of the responses all focused on previous versions of MVC and/or never mentioned the required NuGet packages.

For some reason VS2013, does not include the "Microsoft jQuery Unobtrusive Ajax" package when it builds a default MVC project.

I found that the "jQuery validation" package was not needed either.

Once I installed that package, and added the script references the results were returned correctly to the target DIV.

To confirm, I am using:

- VS2013 with MVC 4.5.1

- jQuery 2.1.3

- Microsoft jQuery Unobtrusive Ajax 3.2.3

In BundleConfig.cs I decided to add a new bundle because of the confusion:

bundles.Add(new ScriptBundle("~/bundles/jqueryunob").Include(

"~/Scripts/jquery.unobtrusive*"));

And then applied it to all pages by referencing it in _Layout.cshtml:

@Scripts.Render("~/bundles/jqueryunob")

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值