Last active
January 3, 2018 08:45
-
-
Save lackneets/c458e1fe8bd43674320893ff90dd1b9d to your computer and use it in GitHub Desktop.
This file contains 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
// Add to application.js | |
$("body").bind("ajaxSend", function(elm, xhr, s){ | |
if (s.type == "POST") { | |
xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content')); | |
} | |
}); | |
// OR | |
$.ajaxSetup({ | |
headers: { | |
'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