public
Last active

jQuery in Rails application

  • Download Gist
app/views/layouts/application.html.erb
HTML+ERB
1 2 3 4 5 6 7 8 9 10 11 12
<%= javascript_include_tag 'jquery', 'jquery-ui' %>
 
<% if protect_against_forgery? %>
<script type='text/javascript'>
//<![CDATA[
window._auth_token_name = "#{request_forgery_protection_token}";
window._auth_token = "#{form_authenticity_token}";
//]]>
</script>
<% end %>
 
<%= javascript_include_tag 'application' %>
public/javascripts/application.js
JavaScript
1
jQuery.ajaxSetup({ 'beforeSend': function(xhr) {xhr.setRequestHeader("Accept", "text/javascript")} })

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.