繁体   English   中英

- 请求的资源上没有“Access-Control-Allow-Origin”标头。 因此不允许Origin'http:// localhost:8100'访问

[英]— No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8100' is therefore not allowed access

尝试从提供程序访问http:Localhost:9000/api/post此错误

Failed to load http://127.0.0.1:8000/api/post: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8100' is therefore not allowed access. is therefore not allowed access

任何人都知道什么是错的。

您的前端和后端位于不同的端口上,这意味着您的ajax请求受到跨源安全性的约束。

您需要通过添加在后端api(服务器端)进行更改

Access-Control-Allow-Origin:“*”;

根据你使用php,java或python等语言的响应头

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM