相关疑难解决方法(0)

在将jQuery更新到1.9.0后,不显眼的Ajax停止工作

我刚刚将jQuery和jQuery UI更新为:jquery-1.9.0.min.js和jquery-ui-1.9.2.min.js

并且...我所有不引人注意的Ajax调用(Ajax.ActionLink,Ajax.BeginForm)都停止正常工作 - 它们在新页面中打开结果,而不是更新现有的div.

当我的页面加载时,我在Firebug中收到此javascript错误:

在此输入图像描述

代码当然没有改变,只是使用Nuget更新了jQuery脚本.

有人经历过同样的问题吗?

jquery asp.net-mvc-3 unobtrusive-ajax

37
推荐指数
4
解决办法
3万
查看次数

ASP.NET MVC RemoteAttribute验证无效 - 操作未执行

我一直在努力弄清楚为什么没有触发ValidationController动作.

我在项目范围的web.config中启用了设置:

<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
Run Code Online (Sandbox Code Playgroud)

我有以下控制器:

[OutputCache(Location = OutputCacheLocation.None, NoStore = true)]
public class ValidationController : Controller
{
    private readonly IUserRepository userRepository;

    public ValidationController(IUserRepository userRepository)
    {
        this.userRepository = userRepository;
    }

    public JsonResult IsUserNameAvailable(string username)
    {
        User user = userRepository.Get(u => u.UserName == username);

        if (user == null) return Json(true, JsonRequestBehavior.AllowGet);
        else return Json(false, JsonRequestBehavior.AllowGet);
    }
}
Run Code Online (Sandbox Code Playgroud)

和以下viewmodel:

    [Required(ErrorMessage = "Required *")]
    [StringLength(50, MinimumLength = 4, ErrorMessage = "Please keep the username between four and twenty …
Run Code Online (Sandbox Code Playgroud)

jquery-validate unobtrusive-validation remote-validation asp.net-mvc-4

5
推荐指数
1
解决办法
8467
查看次数