title: jquery not loading on rails server - '$ is not defined'
body: <p>I have a rails app that is failing to load jQuery when called in some embedded JS within one of my views.  I've looked around and seen some common solutions, so I'll list what I've already done:</p>
  
  <p>jQuery is listed uncommented in my Gemfile:</p>
  
  <pre><code>gem 'jquery-rails'
  </code></pre>
  
  <p>jQuery is loaded in application.js:</p>
  
  <pre><code>//= require jquery
  //= require jquery_ujs
  //= require turbolinks
  //= require_tree .
  </code></pre>
  
  <p>application.html.erb calls with the include tag:</p>
  
  <pre><code>&lt;%= javascript_include_tag 'application', 'data-turbolinks-track'=&gt; true %&gt;
  </code></pre>
  
  <p>I've also tried:</p>
  
  <pre><code>&lt;%= javascript_include_tag 'application' %&gt;
  </code></pre>
  
  <p>Where could this be going wrong?</p>
  
  <p>EDIT:</p>
  
  <p>I was able to get it working but it is a definite workaround and I'd like to figure out a more permanent solution.  Firstly I found that a coworker had set this server up a little differently and application.html.erb was being overridden by another layout, which did not contain the javascript_include_tag line in the head (or anywhere else in the file).  Despite adding that line of code in, the error persisted.  I saved jquery.min.js from the online API link (<a href="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js" rel="nofollow noreferrer">https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js</a>) and placed it in the assets folder, then precompiled and added the following line to the head of the layout:</p>
  
  <pre><code>&lt;%= javascript_include_tag 'jquery.min', 'data-turbolinks-track'=&gt; true %&gt;
  </code></pre>
  
  <p>This finally resulted in the ajax call within my jQuery script successfully calling a script.  However, there are still two problems: first, as I said above, I'd like a more permanent and less hackish solution, and second, the success function from the ajax call is not working, despite it working correctly on my private testing server.  The code is the same between the two, so I know it is not a problem in the code, and I am almost certain it is connected to whatever the underlying problem that is messing with jQuery in general.</p>