A
A
anderson_en2021-11-20 00:17:07
JavaScript
anderson_en, 2021-11-20 00:17:07

How to make a request to another site using Fetch and CORS?

Please tell me how to make a request from one site to another, so that there is no error.
Preferably with an example.

test = await (await fetch('https://testbottg.site/test.json')).json();
console.log(test[0].retutnCount)

6198131cb13b3051927232.png

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Aetae, 2021-11-20
@Aetae

You can make a request without error with no-cors, but you ca n't get an answer . Unless, of course, that site is also not yours.

S
Stalker_RED, 2021-11-20
@Stalker_RED

You need that other site to which you send the request to allow you to make these requests.

N
Nadim Zakirov, 2021-11-20
@zkrvndm

Create a script file in the root of your site that would make a request instead of the browser and give the result to the browser. This is called a proxy.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question