Why did the post request in the ajax I sent become an OPTIONS request? how can I solve the problem with an error of 403?

Why did the post request in the ajax I sent become an OPTIONS request? how can I solve the problem with an error of 403?

                 $.ajax({
                        async: true,
                        type:"post",
                           url: "xxxxxxx",
                       contentType: "application/json;charset=UTF-8",
                           dataType:"json",
                        success:function(data){
                            console.log(data);
                        }
                    })
                    

clipboard.png

clipboard.png

Network

clipboard.png

clipboard.png

wait online!

Mar.17,2021

for cross-domain problems, browsers will send options pre-requests first, and then send real post requests after passing them. Please refer to http://javascript.ruanyifeng.


because cross-domain problems, browsers will first send an options request to see which methods are supported by the backend. The backend needs to process this request


contentType this line is deleted, which means post .

other things have been mentioned by both of you upstairs. And if you monitor the download progress, it will also become options .


Cross-domain can consider using josnp


backend processing. The backend judges that if it is an option request, it will not process it, but just deal with the get,post request


boundless longevity Buddha. How to solve it?

Menu