Created
September 30, 2015 15:11
-
-
Save dholdren/28b5cc13626c23133703 to your computer and use it in GitHub Desktop.
CSRF in all ajax requests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.ajaxSetup( { | |
beforeSend: function ( xhr ) { | |
var token = $( 'meta[name="csrf-token"]' ).attr('content'); | |
xhr.setRequestHeader( 'X-CSRF-Token', token ); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment