A
A
Alexander2021-08-12 23:45:47
CORS
Alexander, 2021-08-12 23:45:47

JS fetch why is it throwing CORS?

Good evening! Please tell me what the problem

is. There is a website: https://api-ip.fssp.gov.ru
Through the API, you need to get the data of a specific person.
I signed up on the site and received a token for

requests

let url = 'https://api-ip.fssp.gov.ru/api/v1.0/search/physical?token=lyzPggx3R0gR&region=61&firstname=Александр&lastname=Александр&secondname=Александр&birthdate=07.07.1981'

    async function fetchTest(param){
        let promise = await fetch(param)
        let respons = await promise.json()
        console.log(respons);
    }

    fetchTest(url)


When requesting an error Access-Control-Allow-Origin
If the url is inserted into the search bar and go, then I get a response

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
antonwx, 2021-08-12
@diamond60

Obviously, because the api needs to be resolved by means of the server, and not the client (browser)
. this is not for js but for php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question