Is “jquery.unobtrusive-ajax.js” obsolete?

2019-03-23 07:11发布

I have an ancient MVC2 solution that I migrated to MVC5 (Visual Studio 2013).

I'd like to update the old libraries used in the project with the new ones.

I have by eg. the jquery.unobtrusive-ajax.js library. Is it obsolete as by now?

I ask because that library references

/// <reference path="jquery-1.4.4.js" />

but I upgraded the jQuery (I use the jQuery v1.8.3 by now).

If it with what to replace (like jquery.validate.unobtrusive.js(?))

PS.
In a default MVC project Visual Studio 2013 proposes the folowing "validation" scripts:

jquery.validate-vsdoc.js
jquery.validate.js
jquery.validate.min.js
jquery.validate.unobtrusive.js
jquery.validate.unobtrusive.min.js

2条回答
我命由我不由天
2楼-- · 2019-03-23 07:16

jquery.unobtrusive-ajax.js is a Microsoft library for supporting @Ajax.* helpers, this is a plugin that unobtrusively sets up jQuery Ajax.

If you use @Ajax helpers in your code, like ActionLink or BeginForm, along with updating jQuery you have to update the Microsoft jQuery Unobtrusive Ajax, otherwise you can remove it.

If you remove reference to the jquery.unobtrusive-ajax.js, @Ajax helpers will be working as regular @Html helpers.

How can I know if I still use them?

Try to look for the usages of these methods.

查看更多
别忘想泡老子
3楼-- · 2019-03-23 07:39

You were asking how you can make sure whether you have the latest jquery-unobtrusive-ajax.js installed (or how to check whether it may be obsolete).

Visual Studio 2010+ comes with the NuGet package manager console (PMC). To see if your project's external references (like, e.g., unobtrusive AJAX) are still up to date:

  1. Open your project in Visual Studio
  2. Right-click your project in Solution Explorer
  3. Select "Manage NuGet packages"
  4. Select the package you want to update (unobtrusive AJAX a/o unobtrusive validation)
  5. Here you can see whether you're using the latest version of the external reference or if an update is available.
  6. Press the [Update] button.
查看更多
登录 后发表回答