亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

如何從jQuery的ajax請求中刪除X-Requested-With

 更新時(shí)間:2013年12月11日 17:48:21   作者:  
X-Requested-With常用于判斷是不是ajax請求,ajax請求中刪除X-Requested-With的方法如下,感興趣的朋友可以參考下
X-Requested-With常用于判斷是不是ajax請求

但是有時(shí)我們會(huì)有需要?jiǎng)h除X-Requested-With的情況

下面介紹一種方式 js代碼
復(fù)制代碼 代碼如下:

$.ajax({
url: 'http://www.zhangruifeng.com',
beforeSend: function( xhr ) {
xhr.setRequestHeader('X-Requested-With', {toString: function(){ return ''; }});
},
success: function( data ) {
if (console && console.log){
console.log( 'Got data without the X-Requested-With header' );
}
}
});

附,判斷ajax請求的方式 java代碼
復(fù)制代碼 代碼如下:

if (request.getHeader("x-requested-with") != null
&& request.getHeader("x-requested-with").equalsIgnoreCase("XMLHttpRequest")) {
//異步請求
}else{

}

相關(guān)文章

最新評論