im making a blog were i will show a product and all of it's prices on all the websites that sell this product, but i whant the prices to be up to date so i decided to make a webscrap script so i can allways get the updated product price, but it does not seem to work... i searched all over the internet and i didn't find anyone that can do this, can you guys help me fix my code? :D
var dd = document.querySelectorAll("dd");
var xhr = new XMLHttpRequest();
xhr.open("GET","https://www.chewy.com/blue-buffalo-life-protection-formula/dp/32041")
xhr.responseType = "document";
xhr.onload = function(){
if(xhr.readyState = 4 && xhr.status == 200)
{
var response = xhr.responseXML.querySelectorAll("#advertised-price")
dd[0].innerText = response[1].children[1].textContent;
console.log(response);
}
};
xhr.onerror = function()
{
console.error(xhr.status, xhr.statusText);
}
xhr.send();