为了账号安全,请及时绑定邮箱和手机立即绑定

CORS报错

跟着老师敲的,但总是报下面的错误
Access to XMLHttpRequest at 'localhost:8090/user/getotp' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.
其他答案里面的方法都用过了,还是不行,有没人能帮忙解决一下呀


正在回答

2 回答

我的是http 写成了htp

0 回复 有任何疑惑可以回复我~

https://img1.sycdn.imooc.com//5d3065610001d73314050842.jpg

@CrossOrigin

这个注解要有,

application/x-www-form-urlencoded

要写对

type:"POST",

contentType:"application/x-www-form-urlencoded",

url:"Http://localhost:8090/user/getotp",

这三块也不能错。

我自己的问题出在url 没写"HTTP://"

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
SpringBoot构建电商基础秒杀项目
  • 参与学习       48689    人
  • 解答问题       950    个

应用SpringBoot快速搭建拥有用户、商品、交易及秒杀活动的电商秒杀应用。

进入课程
意见反馈 帮助中心 APP下载
官方微信