var fet = fetch('info.json', {method : 'GET'}).then(function(response) {
return response.json();
}).catch(alert);
var rs = document.querySelector(".redStream");
rs.addEventListener("click", () => {
fet.then(response => document.body.innerHTML += JSON.parse(response).data0)
});
var fet = fetch('info.json', {method : 'GET'}).then(function(response) {
return response.json();
}).catch(alert);
var rs = document.querySelector(".redStream");
rs.addEventListener("click", () => {
fet.then(response => document.body.appendChild(response.data0))
});
<code>
var fet = fetch('info.json', {method : 'GET'}).then(function(response) {
return response.json();
}).then(function(json) {
return JSON.parse(...);
}).catch(alert);
var rs = document.querySelector(".redStream");
rs.addEventListener("click", fet);
JSON.parse(
JSON.stringify({
"data0": "<h1>hello</h1>",
"data1":"<h1>world</h1>",
"data2":"<h1>hello wordls</h1>"
})
)