Answer the question
In order to leave comments, you need to log in
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)
Answer the question
In order to leave comments, you need to log in
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.
You need that other site to which you send the request to allow you to make these requests.
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 questionAsk a Question
731 491 924 answers to any question