Maison > Questions et réponses > le corps du texte
jquery版本为3.1.1,使用ajaxfileupload.js,结果报错
url.indexOf is not a function
进去查看,应该是调用jquery的load方法出错,
ajaxfileupload中是
jQuery('#' + frameId).load(uploadCallback );
return {abort: function () {}};
},
应该是想使用load事件,缺被判断成了ajax的load方法,3.1.1中用什么替代了load事件?
迷茫2017-04-11 11:08:27
今天也遇到了这个问题,查了一下文档,确实从3.0开始移除了load、unload、error事件方法。不过依然可以用on方法绑定这些事件。
Breaking change: .load(), .unload(), and .error() removed
These methods are shortcuts for event operations, but had several API limitations. The event .load() method conflicted with the ajax .load() method. The .error() method could not be used with window.onerror because of the way the DOM method is defined. If you need to attach events by these names, use the .on() method, e.g. change $("img").load(fn) to $("img").on("load", fn).
https://github.com/jquery/jqu...
https://jquery.com/upgrade-gu...