Answer the question
In order to leave comments, you need to log in
How to return data received with fetch?
Good day.
There is a Fetch request:
let data = fetch('some url')
.then(
response => response,
error => alert(`Rejected: ${error}`)
);
Answer the question
In order to leave comments, you need to log in
var data = null;
fetch('some url')
.then(
response => {
data = response;
},
error => alert(`Rejected: ${error}`)
);
fetch('some url')
.then(
response => {
someFunc(response);
},
error => alert(`Rejected: ${error}`)
);
someFunc(data) {
alert(data);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question