我在从html链接到我的css文件时遇到了一些错误。我收到以下错误。
GET http://localhost:3000/app/assets/javascripts/bootstrap.min.css
habits:30
GET http://localhost:3000/app/assets/stylesheets/application.scss
habits:34
GET http://localhost:3000/assets/js/ie-emulation-modes-warning.js
habits:52
GET http://localhost:3000/assets/js/ie10-viewport-bug-workaround.js
habits.self-f894a4f031f58f24694feda9c89f464976d99c2eda34ee3f03c956dc29757a67.js?body=1:8
Uncaught ReferenceError: Handsontable is not defined
我知道前四个来自引用我的html文件中的css文件的错误,但最后一个错误是什么?我该如何解决?
答案 0 :(得分:1)
Uncaught ReferenceError有时意味着您没有按正确的顺序提供javascript文件。例如,如果脚本依赖于jQuery但是首先加载,那么您将收到此错误。
如果不查看整个代码,就无法准确说出问题的确切位置,但我发现首先链接jQuery,然后是其他脚本,通常会修复错误。
避免此错误的一种方法是将条件脚本放在标题中,如下所示:
<script type="text/javascript">
if (typeof jQuery == 'undefined') {
document.write("<script type=\"text/javascript\" src=\"[jquery CDN of your choice]\"></" + "script>");
}
</script>