Skip to content

Instantly share code, notes, and snippets.

@kramer
Created May 1, 2013 17:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kramer/5496665 to your computer and use it in GitHub Desktop.
Save kramer/5496665 to your computer and use it in GitHub Desktop.
jQuery ajax request interceptor
$.ajaxSetup({
beforeSend: function (xhr) {
xhr.setRequestHeader('X-Bottle-CsrfToken', '{{ session.csrf }}')
}
});
@bigfacewo
Copy link

Ajax's beforeSend will override ajaxSetup's beforeSend settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment