T
T
Turtle_Onni2017-09-20 13:34:34
JavaScript
Turtle_Onni, 2017-09-20 13:34:34

How to implement rest api between different domains?

Hello!
From the side of the server where I want to turn, cross-domain calls are prohibited. How can I implement a request to this server differently?
At the moment I'm getting an error. No 'Access-Control-Allow-Origin' header is present on the requested resource.
Thank you very much in advance!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Seva, 2017-09-20
@Zewkin

JSONP
Or proxy through your server.

A
Andrey Andreev, 2017-09-20
@b0nn1e

https://habrahabr.ru/post/114432/

D
Dmitry Pacification, 2018-02-14
@dmitry_pacification

There is a fetch(url, options) function. It takes as the first parameter the url where to send. Using the `http:\\${domain}\${api}\...` construct, you can dynamically substitute endpoint URLs. The second parameter is the type options that will be in the Header and more. And you can pass an instance of Request as one parameter.
Read more on MDN

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question