JQuery文件上传错误:未捕获TypeError:对象#<对象>没有办法'_on' [英] JQuery-File-Upload error: Uncaught TypeError: Object #<Object> has no method '_on'

查看:206
本文介绍了JQuery文件上传错误:未捕获TypeError:对象#<对象>没有办法'_on'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 jQuery-File-Upload插件。但是当我尝试调用这个函数时,我遇到了一个问题。在我的代码中,我将调用$(fubar).fileupload,并获取 Uncaught TypeError:Object#< Object>没有方法'_on'jquery.fileupload.js:977 。现在这是在页面和所有js脚本被加载后发生的。

A 在工具板上讨论类似的错误。我尝试了在加载dom之后包含jquery.fileupload.js的技巧。我尝试了下面的这个技巧。


 < ; script src ='/ static / presentation / js / lib / jquery.fileupload.js'>< / script> 
< script src ='/ static / presentation / js / lib / jquery.iframe-transport.js'>< / script>
< / body>



但是当加载页面,我得到另一个错误未捕获的错误:不匹配的匿名定义()模块:函数($){...

B)在documentReady上,我甚至试着动态生成并包含脚本标签。但是我得到相同的错误未捕获的错误:不匹配的匿名定义()模块:函数($){...

我使用jquery-file-upload与requirejs。我只是把这个库测试出来,并用一个简单的静态网站来工作。只是基本的js库文件。所以我不知道是什么原因造成的但它似乎不是DOM相关的。



任何帮助都是值得赞赏的。

解决方案

出来。我只需要在 jquery.ui.widget.js jquery.fileupload.js > jquery.iframe-transport.js 。至少我知道以备参考。

pre $ < script src ='/ static / presentation / js / lib / jquery.ui .widget.js'>< /脚本>
< script src ='/ static / presentation / js / lib / jquery.iframe-transport.js'>< / script>
< script src ='/ static / presentation / js / lib / jquery.fileupload.js'>< / script>


I'm trying to use the jQuery-File-Upload plugin. But I have a problem when actually trying to invoke the function. Somewhere in my code, I'll call $(fubar).fileupload, and get Uncaught TypeError: Object #<Object> has no method '_on' jquery.fileupload.js:977. Now this is happening after the page and all js scripts have been loaded.

A) A similar error is discussed in the tool's boards. I tried the technique of including jquery.fileupload.js just after the dom loads. I tried the technique, with something like below.

  <script src='/static/presentation/js/lib/jquery.fileupload.js'></script>
  <script src='/static/presentation/js/lib/jquery.iframe-transport.js'></script>
</body>

But when loading the page, I get another error Uncaught Error: Mismatched anonymous define() module: function ($) {... .

B) On documentReady, I even tried dynamically generating and including the script tags, in head. But I get the same error Uncaught Error: Mismatched anonymous define() module: function ($) {... .

I'm using jquery-file-upload with requirejs. I only bring that up I tested out the library and got it working with a plain jane static site. Just the basic js library files. So I don't know what's causing this. But it doesn't seem to be DOM related.

Any help is appreciated.

解决方案

Ok, I just figured it out. I simply need to include jquery.fileupload.js after jquery.ui.widget.js and jquery.iframe-transport.js . At least I know for future reference.

<script src='/static/presentation/js/lib/jquery.ui.widget.js'></script>
<script src='/static/presentation/js/lib/jquery.iframe-transport.js'></script>
<script src='/static/presentation/js/lib/jquery.fileupload.js'></script>

这篇关于JQuery文件上传错误:未捕获TypeError:对象#&lt;对象&gt;没有办法'_on'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆