有兩個錯誤Uncaught (in promise) TypeError: Failed to fetchFailed to load 'url鏈接' Request header field Content-Type is not allowed by Access-Control-Allow-Headers in preflight response.這是代碼url那里我原來放的是后臺給的地址fetch('url',{ method: 'POST', headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' }, body: JSON.stringify({"password": values.password})}).then(res => res.json()).then(json => console.log(json));
fetch請求出錯
躍然一笑
2019-02-04 16:16:41