What would be the native javascript equivalent to the jquery below?
$('#anyDiv').load("anyPage.htm");
                Yes, there is:
function load(target, url) {
  var r = new XMLHttpRequest();
  r.open("GET", url, true);
  r.onreadystatechange = function () {
    if (r.readyState != 4 || r.status != 200) return;
    target.innerHTML = r.responseText;
  };
  r.send();
}
load(document.getElementById('anyDiv'), 'anyPage.htm');
                        You can try this,
window.onload = () => {
    fetch('/path/to/page.html')
    .then(data => {
      return data.text()
    })
    .then( data => {
      document.getElementById("parentContainer").innerHTML = data;
    })
}
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With