我正在GET从我的服务器向第三方 API 发出请求。请求返回JSON响应。
现在我有了它JSON,我想从前端向服务器发出一个 fetch API 请求,以便检索它JSON并在前端显示它。
目前我的设置是这样的:
www.siteA.com/backend > This is a page on the backend.
It makes a request to a third party site that returns some json data
www.siteA.com/frontend > This is the front end of the site.
I make a fetch request to www.siteA.com/backend to retrieve the json data that
was returned from the backend api request to the third party site.
当我检查从 www.siteA.com/frontend 到 www.siteA.com/backend 的 fetch 请求中得到的响应时,它实际上是在接收整个 html 页面,而我只想要 JSON 数据。
如何从前端检索 json?