Skip to content
Create a gist now

Instantly share code, notes, and snippets.

jQuery in Rails application
<%= javascript_include_tag 'jquery', 'jquery-ui' %>
<% if protect_against_forgery? %>
<script type='text/javascript'>
window._auth_token_name = "#{request_forgery_protection_token}";
window._auth_token = "#{form_authenticity_token}";
<% end %>
<%= javascript_include_tag 'application' %>
jQuery.ajaxSetup({ 'beforeSend': function(xhr) {xhr.setRequestHeader("Accept", "text/javascript")} })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.