0
我已創建使用Axios公司GET請求中的反應如下:Wunderground自動填充API錯誤:否「訪問控制允許來源」標題存在於所請求的資源
searchCity: function(){
return axios.get('https://autocomplete.wunderground.com/aq?query=lond' + '&format=JSON')
}
但是我帶有錯誤:
https://autocomplete.wunderground.com/aq?query=lond&format=JSON. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access.
即使這是一個公共API,並且不需要任何訪問密鑰或任何東西。 是否有另一種方法從這個URL獲取JSON數據?
我一直看着它,並認爲它的方式wundergrounds API設置。如果我在瀏覽器中瀏覽該網址,則會返回數據,並且我製作了一個運行相同請求的jsfiddle,並獲取您收到的相同錯誤。奇怪的是,當我在小提琴手看我的請求,因爲我在jsfiddle中,我可以看到它返回一個200,並獲取數據,但在瀏覽器中,我仍然得到Access-Control-Allow-Origin錯誤 – cstopher
是的,這正是我正在經歷,不確定如何更改我的請求標題中的「原始」值,不確定這是否會工作枯萎 –