Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

219
Vistas
Webscrap product price with javascript

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();

https://codepen.io/galusk0149007/pen/zYRoovY

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda