Rails 3.1 Production - Javascript loads, but doesn't execute

蓝咒 提交于 2019-12-23 05:33:08

问题


I've just uploaded my app to the heroku servers (with cedar stack) "http://hollow-waterfall-4266.herokuapp.com/" and I can see that the files load and are there, but they don't execute.

The css-file is fine and working, but the javascript files aren't. I've looked at a lot of other posts, but nobody seems to have the answer and I have no idea of where to start to debug this.

Any suggestions?


回答1:


Your page is throwing "jQuery is not defined" errors. Your page's source looks like this:

<script src="/assets/jquery-9750cb66f964a0901c68c61b399928dc.rails" type="text/javascript"></script>
<script src="/assets/jquery-1.4.4-d1fb061dfe072deb1a689fdc40b2debe.min" type="text/javascript"></script>
<script src="/assets/countdown-1a430b19ccddfaa55e613c153529478d.js" type="text/javascript"></script>
<script src="/assets/jquery-1e7a267339e7c1853437734d5040d838.infieldlabel" type="text/javascript"></script>
<script src="/assets/charCount-0f5848b48fc67330a2532bbce115bc9c.js" type="text/javascript"></script>
<script src="/assets/application-0dd84c1347591b7d784745c6f5602f7b.js" type="text/javascript"></script>

jQuery should be the first JS file you load before any others. Right now, the unobtrusive JS file is loaded before the actual jQuery 1.4.4 file. Also, it looks like the link to the jQuery file (jquery-1.4.4-d1fb061dfe072deb1a689fdc40b2debe.min) doesn't work.




回答2:


I had messed up my whole asset pipeline. Started a new rails app.



来源:https://stackoverflow.com/questions/9049023/rails-3-1-production-javascript-loads-but-doesnt-execute

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!