32

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
serhio
  • 28,010
  • 62
  • 221
  • 374
  • I set up a new site and it uses the following three validation scripts: jquery.unobtrusive-ajax.js, jquery.validate.js, jquery.validate.unobtrusive.js – Pete Apr 30 '14 at 13:12
  • 1
    From what I can remember `jquery.unobtrusive-ajax.js` is not for validation, but for some ajax helpers like `@Ajax.BeginForm`, `@Ajax.ActionLink` to function ajax activities. So if you don't use them in your page, it is not needed. – tweray Apr 30 '14 at 13:15
  • How can I know if I still use them? Perhaps I upgraded some libraries that replace it functionality...But is there a way to see the "references" to that "ajax" library? I don't have any `@Ajax.BeginForm `or `@Ajax.ActionLink` in the solution's code... – serhio Apr 30 '14 at 13:51
  • I have `@Ajax.GlobalizationScript`, but this is defined in the System.Web.Mvc.Ajax.AjaxExtensions... library – serhio Apr 30 '14 at 13:55

2 Answers2

64

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.

Zabavsky
  • 13,340
  • 8
  • 54
  • 79
  • 1
    What is this: https://www.nuget.org/packages/Microsoft.jQuery.Unobtrusive.Ajax/ then? – Cristian E. Mar 31 '16 at 10:30
  • it this still valid? since it is not listed under the newer mvc5.x http://www.asp.net/ajax/cdn#ASPNET_Web_Forms_and_Ajax_Releases_on_the_CDN_15 – JP Hellemons May 10 '16 at 13:53
  • 2
    MS Ajax is a webforms thing with `UpdatePanel` etc... It has nothing to do with this plugin. "Jquery unobtrusive-ajax" is NOT obsolete. Latest version has been released 2 months ago (I'm witing this in 2018) – Alex from Jitbit Aug 07 '18 at 19:09
-5

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.
AxD
  • 2,714
  • 3
  • 31
  • 53