VB Magic


MVC4 Templates and latest nuget javascript updates causes error in jquery.unobtrusive-ajax.js

Filed under: .NET, ASP.NET MVC — Tags: , , , , , — vbmagic @ 2:21 pm

I updated the nu-get packages for my newly created MVC4 website and I started to get lots of JavaScript errors as shown below.

Error Dialogue

It took a bit of web searching but I found a solution. A feature used in the MVC templates has been removed (Previously it was deprecated) from the latest version of JQuery (1.9)

I found a solution to this on Stack Overflow

Basically you need to add the jQuery.Migrate package to your solution via the package manager:

PM> Install-Package jQuery.Migrate

And then modify the BundleConfig.vb found in the App_Start folder in you project so that it references the jQuery.Migrate package.

Public Class BundleConfig
    ' For more information on Bundling, visit http://go.microsoft.com/fwlink/?LinkId=254725
    Public Shared Sub RegisterBundles(ByVal bundles As BundleCollection)
        bundles.Add(New ScriptBundle("~/bundles/jquery").Include(

This should fix the problem until the templates get updated.

Blog at WordPress.com.