Jquery, No X-Requested-With=XMLHttpRequest in ajax request header?

后端 未结 6 1440
小鲜肉
小鲜肉 2020-12-14 03:35

SOME TIMES there is no X-Requested-With header, sometimes there is.

I checked in firebug and found that, don\'t know why.

So when I use requ

6条回答
  •  轮回少年
    2020-12-14 03:47

    I was facing this issue as well with version 1.6.2, especially when the page has been setting idle for a while. Expanding on jitter's answer, this is adding the X-Requested-With redundantly for every request in one place. I put this in my Master page. Hope this works out.

    $(document).ajaxSend(function (event, request, settings) {
        request.setRequestHeader("X-Requested-With", "XMLHttpRequest");
    });
    

提交回复
热议问题