/** * 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); } });