0
下面的代碼不工作,並返回403禁止,但相同的URL給出正確的響應郵遞員工具。取回api後調用返回403在React js中禁止的錯誤,但在郵遞員工作的相同的URL
fetch('https://example.com/', {
method: 'POST',
headers: {'Content-Type': 'application/json', },
body:JSON.stringify(sampledata),
}).then(result => console.log('success====:', result))
.catch(error => console.log('error============:', error));
什麼結果你回郵遞員? – Guenther
狀態爲200的json格式的成功響應 –
您如何運行代碼?你是從本地文件加載文件還是從http服務器檢索它? – Guenther