JQuery-File-Upload error: Uncaught TypeError: Object #<Object> has no method '_on'
Asked Answered
A

3

17

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.

Apc answered 1/11, 2012 at 21:17 Comment(3)
Have you included the jQuery file in the first place ?Moisture
Yes (fair question). JQuery script load is abouve the jquery-file-upload plugin.Apc
Ok, I just figured it out. See below...Apc
A
25

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>
Apc answered 2/11, 2012 at 0:14 Comment(2)
I'm writing an extension based on jQuery File Upload plugin for Yii framework and had the similar error due to I didn't include jquery.ui.widget.js. Though on the demo page of the plugin one could see in the comments that "The jQuery UI widget factory, can be omitted if jQuery UI is already included". It's not true, at least for jQuery UI 1.8.22 that's coming with Yii 1.1.12.Formenti
I wonder how this was the solution because I had the same problem I fixed it too like you but in their demo page their JS files are scattered everywhere and their "upload" doesn't throw any errors.Seamy
E
0

Make sure you are running complementary versions of jQuery and jQuery UI, and only one copy of jQuery. I realized I had jquery-rails running at 1.10 and a local jQuery 1.11 file, and removing the latter and upgrading the former did the trick.

Enactment answered 27/1, 2015 at 21:8 Comment(0)
K
-1

With the newest version blue imp I just change jquery.ui.widget.js with jquery-ui-1.9.2.custom.min.js and it work well. Hope this help someone stuck with this.

Kasandrakasevich answered 11/11, 2013 at 10:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.