Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

220
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!