I'm trying to get a list from a website and then add it to my popup.html file. The only time i've been able to edit the popup.html file from the content.js is when i remove the parsing section. How would i add the parsed xml response to my popup.html, or is there another way to get an element without parsing the response?
var list;
function getAlerts() {
var xhr = ("XMLHttpRequest" in window) ? new XMLHttpRequest() : new ActiveXObject("Msxml3.XMLHTTP");
xhr.open("GET", 'http://www.example.com/', true);
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status==200) {
var data = xhr.responseText;
var parser = new DOMParser();
var xmlDoc = parser.parseFromString(data, "text/html");
list = xmlDoc.getElementById("grabsomeelements");
console.log(list);
}
};
xhr.send(null);
}
document.addEventListener('DOMContentLoaded', function () {
getAlerts();
document.getElementById("somethinghere").innerHTML=list;
});