'Fetch and Parse XML data from Live product feed
I am simply trying to extract the data from this XML link I have but I have no clue how to run a query like that neither the second source is responding correctly to fetch and parse the feed
Full inventory query: http://idexonline.com/Idex_Feed_API-Full_Inventory?String_Access=7HF7MZ3M0SZ061N39P9T0IN01
Inventory Update query: http://idexonline.com/Idex_Feed_API-Inventory_Update?String_Access=7HF7MZ3M0SZ061N39P9T0IN01
Appreantly I am supposed to run the first link once and then the second update to recieve all product information. So far I have:
document.addEventListener('DOMContentLoaded', ()=>{
//fetch the data as soon as the page has loaded
let url = "http://idexonline.com/Idex_Feed_API-Full_Inventory?String_Access=7HF7MZ3M0SZ061N39P9T0IN01";
fetch(url)
.then(response=>response.text())
.then(data=>{
//console.log(data); //string
let parser = new DOMParser();
let xml = parser.parseFromString(data, "application/xml");
document.getElementById('output').textContent = data;
console.log(xml);
buildHouseList(xml);
buildSwordList(xml);
});
})
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|