I am loading content into a div with XMLHttpRequest, but I want to run pure javascript code to change the contents of another div. I used to work with jquery and it was very simple, but I have not achieved it with pure javascript.
var req = new XMLHttpRequest();
function alertContents() {
if (req.readyState == 4) {
if (req.status == 200) {
document.getElementById('insertar').innerHTML = req.responseText;
}
}
}
The html content, texts and those things are loaded but I execute a simple alert (); inside the script tags and nothing. What solution can you give me?