我最近從使用jQuery轉向與Redux一起使用同構獲取。當在IE中運行時,它設法罰款。不過,我在Chrome中運行時會看到下面的內容。401(未經授權)在Chrome中,但不在IE中
Failed to load resource: the server responded with a status of 401 (Unauthorized)
可能值得注意的是,web api確實啓用了Windows身份驗證。
下面是執行抓取代碼:我想
export const fetchSearchResults = (name) => {
return (dispatch) => {
dispatch(requestSearchResults(name))
return fetch(API URI HERE)
.then(response => response.json())
.then(json => {
console.log('Fetch: ' + json.message.features.length)
dispatch(receiveSearchResults(json))
})
}
}
http://stackoverflow.com/questions/29782222/jquery-ajax-call-results-in-401-unauthorized-response-when-in-chrome-or-firefo –
問題尋求調試幫助(「爲什麼isn'這個代碼是否工作?「)必須包含所需的行爲,特定的問題或錯誤以及在問題本身中重現問題所需的最短代碼。沒有明確問題陳述的問題對其他讀者無益。請參閱:[如何創建最小,完整和可驗證示例](http://stackoverflow.com/help/mcve)。 –
@CanÜrek我的問題涉及到isomorphic-fetch,jQuery可以很好的跨瀏覽器。 –