0

I get the error:

jquery-ui.js:6 Uncaught ReferenceError: jQuery is not defined
index.js:1 Uncaught ReferenceError: $ is not defined

when loading jQuery like this:

<script src="js/jquery.js" charset="utf-8"></script>
<script src="js/jquery-ui.js" charset="utf-8"></script>
<script src="js/index.js" charset="utf-8"></script>

I have no idea whats wrong, i have tried to require() them via my index.js script but that didn't work either!

Thanks for any help!

Theo Sandell
  • 137
  • 2
  • 11
  • Check the browser console (F12 for Chrome) and see if you are getting an errors. My guess is the file path for jQuery is incorrect. –  Jul 21 '16 at 22:47
  • The obvious thing to verify is whether `js/jquery.js` is actually working at the right path. You should be able to look in the network tab of the Chrome debugger and see exactly whether the jquery.js file is successfully being loaded or not. And, if so, does it have the right content. That's what you need to investigate next. – jfriend00 Jul 21 '16 at 22:48
  • I have verified that the path is correct and that the file is correct and not corrupt etc. – Theo Sandell Jul 21 '16 at 22:51
  • Can you reach those files in your browser directly? Do they have Read permission on your web server? – Twisty Jul 21 '16 at 22:54
  • Do you see any 400+ errors in your access logs surrounding those requests? – Twisty Jul 21 '16 at 22:54
  • I just checked the network tab again in the developer tools and all scripts are loading correct (Status code: 200) but i still get the error. – Theo Sandell Jul 21 '16 at 22:57
  • Something is clearly not as you say because if jquery.js is successfully loading and is actually jQuery, then you will not get those errors in the following files. Not much we can do here. Something is not actually as you say. – jfriend00 Jul 21 '16 at 22:58
  • http://i.imgur.com/EUjHcIb.png – Theo Sandell Jul 21 '16 at 23:04
  • 1
    Then, jquery.js is not what you think it is because if it's regular jQuery, it will certainly define `jQuery` and `$`. Also, notice a `0` size for those three files. I'd suggest clearing your cache and checking the contents of those files in the network tab. – jfriend00 Jul 21 '16 at 23:14
  • http://stackoverflow.com/search?q=jquery+is+not+defined – Castro Roy Jul 21 '16 at 23:33

0 Answers0