Access to XMLHttpRequest at 'http://localhost:3000/getCoordinateByAddress' from origin 'http://127.0.0.1:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource
Access to XMLHttpRequest at 'http://localhost:3000/getCoordinateByAddress' from origin 'http://127.0.0.1:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource
原因:跨域访问了,html在一个网址上,后天服务在另一个网址上。
(localhost
与127.0.0.1
)
前段后端都改为127.0.0.1就行。