Answer the question
In order to leave comments, you need to log in
Why is fetch not output?
Why does he not want to give out the contents of the file, but also does not write an error?
The syntax of the fetch method is:
let promise = fetch(url[, options]);
url is the URL to make a request to,
options is an optional object with request settings.<button class="redStream">Make</button>
let fet = fetch('info.json').then(function(response) {
return response.json();
}).catch(alert);
var rs = document.querySelector(".redStream");
rs.addEventListener("click", fet);
// info.json
{
"data0": "<h1>hello</h1>",
"data1":"<h1>world</h1>",
"data2":"<h1>hello wordls</h1>"
}
Answer the question
In order to leave comments, you need to log in
Why does he not want to give out the contents of the file
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question