I have just updated jQuery & jQuery UI to: jquery-1.9.0.min.js and jquery-ui-1.9.2.min.js
And... all my unobtrusive Ajax calls (Ajax.ActionLink, Ajax.BeginForm)
The easiest way to fix problems with the breaking changes in jQuery(in my opinion) is to install the jQuery.Migrate
package that enables you to use deprecated function calls that were removed in version 1.9.0 onwards. At least until the unobtrusive ajax plugin is updated by Microsoft.
Also, it appears that the nightly build of the unobtrusive ajax plugin have updated the api calls. I haven't tested it yet but you may find out how to acquire it in the asp.net codeplex page.
UPDATE:
The Unobtrusive Ajax and Validation Nuget packages were updated so the jQuery.Migrate
package isn't needed anymore.
Update: This issue has been fixed in the latest NuGet package. I've posted another answer to reflect this. https://stackoverflow.com/a/15539422/714309
In jquery.unobtrusive-ajax.js
, find and replace these four lines:
$("a[data-ajax=true]").live("click", function (evt) {
$(document).on("click", "a[data-ajax=true]", function (evt) {
$("form[data-ajax=true] input[type=image]").live("click", function (evt) {
$(document).on("click", "form[data-ajax=true] input[type=image]", function (evt) {
$("form[data-ajax=true] :submit").live("click", function (evt) {
$(document).on("click", "form[data-ajax=true] :submit", function (evt) {
$("form[data-ajax=true]").live("submit", function (evt) {
$(document).on("submit", "form[data-ajax=true]", function (evt) {
You can also generate a new jquery.unobtrusive-ajax.min.js
using WebGrease.
From the Command Prompt, change to your solution folder and enter this command (assuming your project folder is called Web
):
packages\WebGrease.1.3.0\tools\WG.exe -m -in:Web\Scripts\jquery.unobtrusive-ajax.js -out:Web\Scripts\jquery.unobtrusive-ajax.min.js
.live()
has been deprecated since 1.7 and was officially removed in jQuery 1.9. Use .on()
instead as it is the preferred method of doing the same thing.
Also need to do these fixes :
Update jQuery.Validation plugin (to fix this problem)
https://nuget.org/packages/jQuery.Validation/1.11.0 (first available on nuget 2/4/13)
Also make these changes to the jquery.unobtrusive-ajax.js
file (see here for Connect issue)
Line 43: replace = container.attr("data-valmsg-replace") && $.parseJSON(container.attr("data-valmsg-replace")) !== false;
Line 73: replace = container.attr("data-valmsg-replace") && $.parseJSON(container.attr("data-valmsg-replace"));
Update the Microsoft jQuery Unobtrusive Ajax NuGet package to the latest version.
In Visual Studio, from the Tools menu, select Library Package Manager and then click Package Manager Console. At the prompt, type:
Update-Package Microsoft.jQuery.Unobtrusive.Ajax
This issue was fixed in Microsoft jQuery Unobtrusive Ajax 2.0.30116.0 (Monday, February 18, 2013), which replaced the calls to the .live()
method (deprecated in jQuery 1.7 and removed from jQuery 1.9) with the recommended .on()
method.
Just update your Scripts
1. Download latest Jquery, (I used jquery-1.11.0 though)
2. Download latest Microsoft.jQuery.Unobtrusive.Ajax from from Microsoft official
From here:
https://github.com/aspnet/jquery-ajax-unobtrusive
3. Do hard refresh or Clear your browser cache and check your page again.
Hope helps someone.