Response to preflight request doesn't pass access control check: It does not


看下報錯截圖:

 

 做項目時候發現,有個傳輸給后端sql語句的的接口有時候可以,有時候會報錯,原因是因為,我們用的是post,sql是拼接在url上面(個人認為放在body里面會好點,但是接口時拼接url上,將就下),當傳輸帶有特殊符號時候例如 %    [  ]   /  等等,這些沒有經過轉義,導致出錯。

錯誤重現:

如下圖特殊符號:

 

 

 

 解決:

我們只需要在傳輸時候,使用轉義  encodeURI( )   ,這個方法接受有個string參數

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



猜您在找 Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' heade 「日常報錯」Response to preflight request doesn't pass access control check: It does not have HTTP ok status. Vue前台,跨域請求報錯“Response to preflight request doesn't pass access control check” nginx 實現 ajax 跨域請求Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin 跨域報錯has been blocked by CORS policy: Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request. has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8000' is therefore not allowed a 跨域請求錯誤: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource ajax post上傳數據時,前端出現的跨域權限問題:ccess to XMLHttpRequest at ‘’rom origin 'null' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok st
 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM