that is correct. jquery 1.9 removed deprecated features like .live(), which unobstrusive-ajax uses. you can not upgrade to jquery 1.9 until there is a new release of unobtusive-ajax library, or you update the code yourself.
You may want to use jQuery Migrate (there is a NuGet package for that; otherwise the script is available at jquery.com) to keep older scripts working with jQuery 1.9.0. Just make sure to include it in your page and/or jQuery script bundle. (I.e. until there
is an updated release of the unobtrusive-ajax scripts and others that use deprecated jQuery features.)
You can also change the Live method by the on method, it's only 4 functions to be replaced.
P.S.: in this form i'm calling the js once in the layout, if you want to call on every page, change the body by the selector in the last line of each function
Charles_LiCC
0 Points
2 Posts
jquery.unobtrusive-ajax.js error with jQuery 1.9.0 updated
Jan 23, 2013 02:21 AM|LINK
Created a default ASP.NET MVC Web Application.
Update the NuGet Packages, except the jQuery 1.7.1.1 one.
Run the application, register a new account, login the account. Everything work fine.
Then, update the jQuery from 1.7.1.1 to 1.9.0 with the NuGet Management.
Run the application and try login, error on jquery.unobtrusive-ajax.js (Microsoft jQuery Unobtrusive Ajax) at line 115 will happen:
0x800a01b6 - Microsoft JScript 執行階段錯誤: object doesn't support this property or method 'live'
Anyone can help? Thanks.
bruce (sqlwo...
All-Star
36644 Points
5432 Posts
Re: jquery.unobtrusive-ajax.js error with jQuery 1.9.0 updated
Jan 23, 2013 02:43 AM|LINK
that is correct. jquery 1.9 removed deprecated features like .live(), which unobstrusive-ajax uses. you can not upgrade to jquery 1.9 until there is a new release of unobtusive-ajax library, or you update the code yourself.
Charles_LiCC
0 Points
2 Posts
Re: jquery.unobtrusive-ajax.js error with jQuery 1.9.0 updated
Jan 23, 2013 03:06 AM|LINK
thanks for reply and help.
Michael P.
Member
2 Points
1 Post
Re: jquery.unobtrusive-ajax.js error with jQuery 1.9.0 updated
Jan 29, 2013 01:02 PM|LINK
You may want to use jQuery Migrate (there is a NuGet package for that; otherwise the script is available at jquery.com) to keep older scripts working with jQuery 1.9.0. Just make sure to include it in your page and/or jQuery script bundle. (I.e. until there is an updated release of the unobtrusive-ajax scripts and others that use deprecated jQuery features.)
Irauan Lage
Member
2 Points
1 Post
Re: jquery.unobtrusive-ajax.js error with jQuery 1.9.0 updated
Feb 06, 2013 11:32 AM|LINK
You can also change the Live method by the on method, it's only 4 functions to be replaced.
P.S.: in this form i'm calling the js once in the layout, if you want to call on every page, change the body by the selector in the last line of each function
$("body").on({
click: function (evt) {
evt.preventDefault();
asyncRequest(this, {
url: this.href,
type: "GET",
data: []
});
}
}, "a[data-ajax=true]");
$("body").on({
click: function(evt) {
var name = evt.target.name,
$target = $(evt.target),
form = $target.parents("form")[0],
offset = $target.offset();
$(form).data(data_click, [
{ name: name + ".x", value: Math.round(evt.pageX - offset.left) },
{ name: name + ".y", value: Math.round(evt.pageY - offset.top) }
]);
setTimeout(function() {
$(form).removeData(data_click);
}, 0);
}
}, "form[data-ajax=true] input[type=image]");
$("body").on({ click: function (evt) {
var name = evt.target.name,
form = $(evt.target).parents("form")[0];
$(form).data(data_click, name ? [{ name: name, value: evt.target.value}] : []);
setTimeout(function () {
$(form).removeData(data_click);
}, 0);
}
}, "form[data-ajax=true] :submit");
$("body").on({
submit: function (evt) {
var clickInfo = $(this).data(data_click) || [];
evt.preventDefault();
if (!validate(this)) {
return;
}
asyncRequest(this, {
url: this.action,
type: this.method || "GET",
data: clickInfo.concat($(this).serializeArray())
});
}
}, "form[data-ajax=true]");