JSFiddle - React, Tailwind, and code Playground
by João Vitor Scheuermann
JavaScript
function loadXML (path, cb) {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
cb(this); // start animation
}
};
xhttp.open("GET", path, true);
xhttp.send();
}
function objectfyXML (xml, cb) {
var itens = new Array();
var entries = xml.getElementsByTagName("entry");
for (var index in entries) {
if (entries[index].childNodes !== undefined) {
var currentItem = cb(entries[index].childNodes);
itens.push(currentItem);
}
}
return itens;
}
var link = "https://timbiras.ymi.com.br/share/ofertas_congeladas.xml"
loadXML(link, function(xml) {
objectfyXML(xml.responseXML, function (entry) {
return {
}
})
})