0

I've seen piles of theory answers, and no simple "just do this." At this point, the noise has buried the signal. Seriously. I'm buried in 100,000 words of text that I don't need.

Here's what I have:

document.getElementById('content').innerHTML = function1('/content.html');

function function1(url='') {
  if (url != '') {
    function2(url)
      .then( fromF2 => console.log(fromF2) );
  }
}

async function function2(url) {
  const response = await fetch(url);
  if (response.ok) {
    return response.text();
  }
}

console.log(fromF2) gives me perfectly valid html to the console. Would someone please just tell me the simple/stupid answer to get that perfectly valid html back up to document.getElementById('content').innerHTML?

dafydd
  • 267
  • 1
  • 2
  • 10

0 Answers0