2017年11月22日 星期三

跨域的請求會請求兩次?

為什打開F12我的請求會有兩次,爾且第二次才有回應?


In 
CORS, a preflight request with the OPTIONS method is sent, so that the server can respond whether it is acceptable to send the request with these parameters

https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/OPTIONS





原來是因為ajax異步的關係

https://forums.asp.net/t/2068723.aspx?AJAX+called+twice+and+success+event+runs+second+time+

沒有留言:

張貼留言