No 'Access-Control-Allow-Origin' header is present on the requested resource.'Ajax跨域访问解决方案

最近写的一个接口被跨域调用,但前端会返回No 'Access-Control-Allow-Origin' header is present on the requested resource.

查了一下,大概是因为ajax跨域访问不被浏览器接受引起的

可在后端controller接口上加一个注解

@CrossOrigin

你可能感兴趣的:(No 'Access-Control-Allow-Origin' header is present on the requested resource.'Ajax跨域访问解决方案)