我正在通过fetch来获取数据,并且总是收到此错误:
class datetime
{
public:
// ...
// This function modifies the current object in place
void to_utc();
// This function returns a new datetime object
datetime to_utc() const;
};
但是,如果我手动将URL插入浏览器,则可以正常工作,因此我不知道为什么它会不断出错?
答案 0 :(得分:0)
因此,事实证明该错误与CORS相关。我需要通过代理服务器运行获取请求。
因此,与其直接致电Google,不如打电话给服务器:
const url = 'http://myproxyserver.test/wp-json/google-places/v1/get-reviews';