Created
May 4, 2018 14:36
-
-
Save jaydenlin/f9b8b452126ac4b0ff2b29659e3182a5 to your computer and use it in GitHub Desktop.
CSRF POST ajax.js
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
$(function () { | |
var token = $("meta[name='_csrf']").attr("content"); | |
var header = $("meta[name='_csrf_header']").attr("content"); | |
$(document).ajaxSend(function(e, xhr, options) { | |
xhr.setRequestHeader(header, token); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment