我正在将 jquery ajax 更改为 axios,但我没有跨域使用 axios:
axios.get(myurl, {
headers: { 'crossDomain': true },
}).then(res => {
console.log(res);
}).catch(error => {
console.log('erro', error);
})
我的 jquery 代码正在运行:
$.ajax({
type: 'GET',
crossDomain: true,
url:myurl,
success: (res) => {},
error: (fail) => {}
})
错误:预检响应中的 Access-Control-Allow-Headers 不允许请求 header 字段 crossDomain。
谁能帮我吗?
请您参考如下方法:
“crossDomain”不必位于 header 中
axios.get(myurl, {
crossDomain: true
}).then(res => {
console.log(res);
}).catch(error => {
console.log('error', error);
})
问候






