XMLHttpRequest changes POST to OPTION

前端 未结 4 612
难免孤独
难免孤独 2020-12-07 20:23

i have this code:

net.requestXHR = function() {
    this.xhr = null;
    if(window.XMLHttpRequest === undefined) {
        window.XMLHttpRequest = function()         


        
4条回答
  •  清歌不尽
    2020-12-07 20:58

    Answer:

    Your browser is initiating a PreFlight OPTIONS request.

    Why: Because your request is not a simple request.

    Why it is not a simple request: Because of "Content-Type" = "application/json".

    Solution: Try to use either of below content types :

    • application/x-www-form-urlencoded
    • multipart/form-data
    • text/plain

提交回复
热议问题