Possible Duplicate:
07000
//解决方案:我简单地替换了四个出现,像批准的答案建议和不引人注意的ajax插件,并再次使用jquery 1.9.0
更新//观察底部标记的答案的意见,这是解决此问题的最佳方式.
//原帖:
我升级到jQuery 1.9.0,但随之而来的ajax插件已经不推荐使用live方法了.我试图替换它,因为升级修复了我的另一个错误.但是,它不起作用我只是像这样替换了live:
$("a[data-ajax=true]").on("click",function (evt) { evt.preventDefault(); asyncRequest(this,{ url: this.href,type: "GET",data: [] }); }); $("form[data-ajax=true] input[type=image]").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] :submit").on("click",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]").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()) }); });
解决方法
(授权)等同于:
$(document).on("click","a[data-ajax=true]",function (evt) {...});
你可以在这里找到jquery的.on()方法文档:
>> http://api.jquery.com/on/ <<
The .on() method attaches event handlers to the currently selected set
of elements in the jQuery object. As of jQuery 1.7,the .on() method
provides all functionality required for attaching event handlers. For
help in converting from older jQuery event methods,see .bind(),
.delegate(),and .live().To remove events bound with .on(),see
.off(). To attach an event that runs only once and then removes
itself,see .one()