简体   繁体   中英

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. 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. In this file: /app/assets/javascripts/ application.js there is a code block like this:

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 $ */ . It's same with other files who end with .js in javascripts folder.

I have installed all gems and in 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 $ */ will stop showing up!

Hope this helps, it worked for me!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM