XMLHttpRequest not adding header - “X-Requested-With: XMLHttpRequest”

前端 未结 3 2046
没有蜡笔的小新
没有蜡笔的小新 2020-12-30 02:41

I have an ajax call where I used jQuery.ajax() to make a request to an mvc action. This all worked fine. However due to some forms having a file control I changed it from us

3条回答
  •  攒了一身酷
    2020-12-30 03:22

    X-Requested-With is automatically added by jQuery. You can just as easily add it yourself with AjaxRequestObject.setRequestHeader(). Docs

提交回复
热议问题