且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

尝试通过https://api.thetvdb.com/向TVDB REST API发出JSON POST请求,但收到CORS错误

更新时间:2022-11-27 18:54:07

您的Python请求有效,因为它来自您的服务器或本地计算机,并且

Your Python request works because it is coming from your server or local machine, and the same origin policy only applies inside a browser.

您***的答案是使用服务器端脚本.让您的客户端POST请求转到服务器上的控制器或端点,然后触发服务器脚本.假设API有一些返回数据,您可以将其添加到服务器的响应中,然后将其发送给客户端.

Your best answer is to use a server-side script. Have your client side POST request go to a controller or endpoint on your server, which then triggers the server script. Assuming there is some return data from the API, you'd add that to your server's response and then send it to the client.