和正确的脚本加载顺序

和正确的脚本加载顺序

本文介绍了MVC5、AjaxHelper 和正确的脚本加载顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,我觉得我必须发布一个新问题才能找到答案非常荒谬,但是,唉,我在这里.让我们尽可能简单地让下一个想要解决这个问题的任性灵魂.

OK, I find it EXTREMELY ridiculous that I have to post a new question to find the answer but, alas here I am. Let's make this as simple as possible for the next wayward soul looking to resolve this.

让 ajax 表单工作所需的所有最新脚本是什么?到目前为止我有;

What are all the most current scripts I require to get the ajax form working?Thus far I have;

<script src="//ajax.aspnetcdn.com/ajax/jQuery/jquery-1.11.0.js"></script>
<script src="//ajax.aspnetcdn.com/ajax/jquery.ui/1.10.4/jquery-ui.min.js"></script>
<script src="//ajax.aspnetcdn.com/ajax/jquery.validate/1.12.0/jquery.validate.js"></script>
<script src="//ajax.aspnetcdn.com/ajax/mvc/5.0/jquery.validate.unobtrusive.min.js"></script>

我曾看到一些页面说我也需要 jquery.unobtrusive-ajax.js,但这只会给我一个错误.我是否加载了一些不兼容的版本?

I have seen pages that state I need jquery.unobtrusive-ajax.js as well, but that just gives me an error. Do I have some incompatible versions loaded?

我过去曾多次为 MVC3 等工作过,但我似乎找不到一个简单的页面来解释当前版本的代码期望,这很愚蠢.

I've worked with this several times in the past for MVC3 etc, but it's just silly that I cannot seem to find a simple page explaining the code expectations for the current version.

提前感谢任何能帮我把我的头从今天下午似乎被牢牢卡住的地方移开的人.

Thank you in advance to anyone who can help me remove my head from where it appears to be firmly stuck this afternoon.

推荐答案

AjaxHelper

NuGet 包 Microsoft jQuery Unobtrusive Ajax 3.1.2

> Install-Package Microsoft.jQuery.Unobtrusive.Ajax -Version 3.1.2

现在包含脚本

<script src="~/jquery-1.11.0.js"></script>
<script src="~/jquery.unobtrusive-ajax.js"></script>

继续获取最新版本(如果有).我指定了 v3.1.2 来证明 AjaxHelper 在特定时间至少适用于这个特定版本.

Go ahead and get the latest version if available. I specified v3.1.2 to demonstrate that the AjaxHelper worked for at least this particular version at a particular time.

这篇关于MVC5、AjaxHelper 和正确的脚本加载顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 21:45