开发者

Uncaught ReferenceError: $ is not defined in jquery ui autocomplete

I've been using jQuery UI autocomplete and it works perfectly in the development side. However, when I already deployed it (prod side), I cannot get it working. I used JS debugger in Chrome (Ctrl+Shift+J) ang got these errors:

jquery-1.4.4.js -Failed to load resource: the server responded with a status of 404 (Object Not Found)

jquery.ui.position.js -Failed to load resource: the server responded with a status of 404 (Object Not Found)

jquery.ui.widget.js -Failed to load resource: the server responded with a status of 404 (Object Not Found)

jquery.ui.core.js -Failed to load resource: the server responded with a status of 404 (Object Not Found)

jquery.ui.autocomplete.js -Failed to load resource: the server responded with a status of 404 (Object Not Found)

index.cfm:276Uncaught ReferenceError: $ is not defined

jquery.ui.all.css -Failed to load resource: the server responded with a status of 404 (Object Not Found)

This is a part of my code that references the scripts above:

<script src="jquery-ui-1.8.10.custom/development-bundle/jquery-1.4.4.js"></script>
<script src="jquery-ui-1.8.10.custom/development-bundle/ui/jquery.ui.core.js"></script>
<script src="jquery-ui-1.8.10.custom/development-bundle/ui/jquery.ui.widget.js"></script>
<script src="jquery-ui-1.8.10.custom/development-bundle/ui/jquery.ui.position.js"></script>
<script src="jquery-ui-1.8.10.custom/development-bundle/ui/jquery.ui.autocomplete.js"></script>
<link rel="stylesheet" href="jquery-ui-1.8.10.custom/development-bundle/themes/base/jquery.ui.all.css">

<sc开发者_运维技巧ript type="text/javascript">
    $(function() {
           ...

I already double checked the paths and they are correct. I also tried changing $(function() to jQuery(function() but still doesn't work. I find it hard to debug because there are no errors in the dev side. Did I miss something here? Thank you.


Even though you say that the path is correct, it isn't. You have set relative URLs ass your src. Are you accessing that page from a subdirectory or anything? Try setting an absolute path (relative to your webroot).


That's certainly a path problem, might be the .js doesn't exists. Try, giving path from the root (absolute path)


I've seen this error when trying to include a js in my <head>

I moved the <script></script> closer to the </body> and it loaded ok...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜