[英]Ruby on Rails in Cloud9 doesn't recognize jQuery/javascript
I have no idea why Ruby on Rails in Cloud 9 framework doesn't recognize javascript applications. 我不知道为什么Cloud 9框架中的Ruby on Rails无法识别javascript应用程序。 I have taken Ruby on Rails course via Udemy, and here is correct repo file from Udemy teacher, and when I copy this code into Cloud 9 framework.
我通过Udemy参加了Ruby on Rails课程,这里是来自Udemy老师的正确repo文件 ,当我将此代码复制到Cloud 9框架中时。 In this file: /app/assets/javascripts/ application.js there is a code block like this:
在这个文件中:/ app / assets / javascripts / application.js有一个这样的代码块:
var hide_spinner = function(){
$('#spinner').hide();
}
and within '$' sign is showing following error: $ is not defined; please fix or add /* global $ */
并在'$'符号内显示以下错误:
$ is not defined; please fix or add /* global $ */
$ is not defined; please fix or add /* global $ */
. $ is not defined; please fix or add /* global $ */
。 It's same with other files who end with .js in javascripts folder. 它与在javascripts文件夹中以.js结尾的其他文件相同。
I have installed all gems and in application.js: 我在application.js中安装了所有宝石:
//= require jquery
//= require jquery_ujs
//= require twitter/bootstrap
// require turbolinks
//= require_tree .
Sorry for my English :) 对不起我的英语不好 :)
Please help! 请帮忙!
Thank you! 谢谢! ;)
;)
Sinmply add this: 简单补充一下:
/* global $ */
to the top of your script 到你的脚本的顶部
and $ is not defined; please fix or add /* global $ */
和
$ is not defined; please fix or add /* global $ */
$ is not defined; please fix or add /* global $ */
will stop showing up! $ is not defined; please fix or add /* global $ */
将停止显示!
Hope this helps, it worked for me! 希望这有帮助,它对我有用!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.