X-requested-with is often used to determine whether the AJAX request, the AJAX request to delete the X-requested-with method as follows, interested friends can refer to the following
X-requested-with is often used to determine whether AJAX requests but sometimes we need to remove X-requested-with. The following is a way to introduce the JS code code as follows: $.ajax ({url: ' Http://www.zhan Gruifeng.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 '); } } }); The way to determine the AJAX request Java code code is as follows: if (Request.getheader ("X-requested-with")!= null && request.getheader (" X-requested-with "). Equalsignorecase (" XMLHttpRequest ")) {//asynchronous request}else{}