Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 342
Nutritioustim Avatar asked Nov 01 '12 21:11

Nutritioustim


1 Answers

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>
like image 102
Nutritioustim Avatar answered Sep 22 '22 17:09

Nutritioustim