在开发一个vue小项目,后台用nodejs搭的,向服务器发送正确的用户名密码会得到一个token,用postman可以正确获得。但是在vue里怎么实现?
结果报错是这样的:
XMLHttpRequest cannot load http://localhost:8000/api/aut... Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access.
Uncaught (in promise) Response {url: "http://localhost:8000/api/authenticate", ok: false, status: 0, statusText: "", headers: Headers…}
如果能提供demo或者代码的话,感激不尽。
向远处服务器发送请求跨域问题
php如果开发APP服务器端
云函数发送请求可以直接请求服务器ip吗,没有域名更没有备案,只是自己搭建的一个服务器
zTree如何通过ajax向服务器请求数据?
相关分类