Skip to content

Instantly share code, notes, and snippets.

@marvinahv
Created November 9, 2015 07:46
Show Gist options
  • Save marvinahv/94dc0cbda6f80374810b to your computer and use it in GitHub Desktop.
Save marvinahv/94dc0cbda6f80374810b to your computer and use it in GitHub Desktop.
Javascript file for ajax sign in Ruby
$(window).load(function(){
(function(jQuery) {
$.ajaxSetup({
beforeSend: function(xhr) {
var token = jQuery('meta[name="_csrf"]').attr('content');
xhr.setRequestHeader('X-CSRF-Token', token);
}
});
}(jQuery));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment