Skip to content

Instantly share code, notes, and snippets.

@yellow5
Created February 15, 2011 15:15
Show Gist options
  • Save yellow5/827631 to your computer and use it in GitHub Desktop.
Save yellow5/827631 to your computer and use it in GitHub Desktop.
A way to pass along csrf meta tag with Ajax requests
$.ajaxSetup({
'beforeSend': 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