lang/js/ FetchExamples


See mozilla

fetch('http://example.com/movies.json')
  .then((response) => response.json())
  .then((data) => console.log(data));
const q = (x,y=document) => y.querySelector(x)
const qq = (x,y=document) => Array.from(y.querySelectorAll(x))
const reload_content = _ => {
  fetch("/update")
    .then(response => response.text())
    .then(text=> {
      q("div.content").innerHTML = text
    })
}