后端解决前后端分离跨域问题:Access to XMLHttpRequest at 'http://127.0.0.1:1203/stu/addStu' from origin 'http://localhost:8081'

后端解决前端使用ajax访问后端出现的跨域问题

Access to XMLHttpRequest at 'http://127.0.0.1:1203/stu/addStu' from origin 'http://localhost:8081' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

后端Controller添加@CrossOrigin注解即可

 

posted @ 2021-12-06 18:26  不经意的瞬间  阅读(2260)  评论(0编辑  收藏  举报