Rails Ajax Error: "Turbolinks is not defined"
<p>I'm using Rails 4.2 and I want to send an ajax request to my server. But the request always fails with the error <code>Turbolinks is not defined</code>. My rails console returns a 200 ok response.
I am using the <a href="https://github.com/kossnocorp/jquery.turbolinks" rel="nofollow noreferrer">'jquery-turbolinks'</a> gem.</p>
<p>Thanks in advance!</p>
<p>Ajax</p>
<pre><code>$.ajax({
  type: &quot;PUT&quot;,
  url: &quot;http://localhost:3000&quot;,
  data: xx,
  success: function(data){
     alert(&quot;success&quot;);
  },
  error: function(XMLHttpRequest, textStatus, errorThrown) {
       alert(&quot;some error&quot;);
  }
});
</code></pre>
<p>Controller</p>
<pre><code>  def upvote
     # code here
     @vote.save
     respond_to do |format|
       format.html { redirect_to :back }
       format.json { head :ok }
       format.js { head :ok }
     end
   end
</code></pre>