You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
simple-yewu/frontend/web/js/ajax.js

11 lines
376 B

5 years ago
/**
* Created by chaoxinzeng on 2017/2/20.
*/
$('body').bind("ajaxSend",function(elm,xhr,s) {
var csrf_param = $('meta[name=csrf-param]').prop('content');
var csrf_token = $('meta[name=csrf-token]').prop('content');
if(s.type == "POST") {
xhr.setRequestHeader('X-CSRF-Param',csrf_param);
xhr.setRequestHeader('X-CSRF-Token',csrf_token);
}
});