Today has been a bit challenging for me. I've been attempting to use JavaScript to load content into a <div>
. Here is the JavaScript code I'm working with:
function loadXMLDoc(filename) {
var xmlhttp;
if (window.XMLHttpRequest) {
xmlhttp = new XMLHttpRequest();
} else {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
after_load_function(xmlhttp.responseText);
}
}
xmlhttp.open("GET", filename, true);
xmlhttp.send();
}
function after_load_function(responseText) {
document.getElementById("right").innerHTML = responseText;
}
window.onload = function () {
loadXMLDoc("welcome.html");
}
Here is my div:
<div id="right"></div>
Does anyone have any insights on what might be causing the issue?