1. 程式人生 > >AJAX跨域原因及解決方法

AJAX跨域原因及解決方法

3.服務端增加過濾器,將瀏覽器判斷跨域請求的頭加上。例如跨域報錯:Failed to load http://localhost:8080/get1: No 'Failed to load http://localhost:8080/get1: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8081' is therefore not allowed access. The response had HTTP status code 403.' header is present on the requested resource. Origin 'http://localhost:8081' is therefore not allowed access. The response had HTTP status code 403.