A
A
ArtemEfremov2020-06-06 11:05:05
JavaScript
ArtemEfremov, 2020-06-06 11:05:05

fetch returns nothing?

fetch returns nothing. Banal request to Api vk.com.

fetch("https://api.vk.com/method/messages.send").then(data => {
 document.write(data);
});


Or even like this:
var response = fetch("https://api.vk.com/method/messages.send");
document.write(response.text());


Just emptiness. Even in response or data.
When I make a request with parameters (token, message, recipient, then the request is sent, but there is no response from it)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
tempick, 2020-06-06
@ArtemEfremov

the browser is blocking your requests because this is a cross domain request. To be able to send a request, use the Javascript SDK or JSONP (everything is in the documentation for vk api)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question