Skip to content

Instantly share code, notes, and snippets.

@joshmn
Created October 4, 2013 19:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshmn/6831378 to your computer and use it in GitHub Desktop.
Save joshmn/6831378 to your computer and use it in GitHub Desktop.
Accept non-GET AJAX via jQ while Authenticated inside a Ruby on Rails application (devise, simpleauth)
$(document).ajaxSend(function (_, xhr) {
xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content'));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment