ajax 跨域查看

var CSRF_HEADER = 'X-CSRF-Token';

var setCSRFToken = function(securityToken) {

  jQuery.ajaxPrefilter(function(options, _, xhr) {

  if ( !xhr.crossDomain ) xhr.setRequestHeader(CSRF_HEADER, securityToken);

 });

};

 

setCSRFToken($('meta[name="csrf-token"]').attr('content'));

posted @ 2018-06-05 10:09  吃饭了吗  阅读(200)  评论(0编辑  收藏  举报