2016-02-20 55 views
2

我正在處理Ionic框架,我想在我的Ionic框架中使用$ http服務訪問Restful API,我可能在控制檯中收到以下錯誤。無法訪問離子應用程序的另一個http資源

XMLHttpRequest cannot load https://apiexample.com/token/ 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:8100' is therefore not allowed access. The response had HTTP status code 405. 

任何人都知道如何從我的角度使用的js服務$http訪問該休息完整的API?

任何幫助將不勝感激,在此先感謝:d

回答

1

這就是您需要啓用服務器端的設置。確保在服務器端有正確的CORS設置。

相關問題