JSFiddle - React, Tailwind, and code Playground
JavaScript
$(document).ready(function () {
$.ajax({
type: "GET",
url: "http://www.camara.gov.br/SitCamaraWS/Deputados.asmx/ObterDeputados",
//url: "dep.xml",
dataType: "xml",
success: parseXml
});
}); ///eof Ready
var deputados = [];
function parseXml(xml) {
var base = xml.firstChild;
$(base).find("deputado").each(function () {
var deputado = {
idCadastro: $(this).find("ideCadastro").text(),
condicao: $(this).find("condicao").text(),
matricula: $(this).find("matricula").text(),
idParlamentar: $(this).find("idParlamentar").text(),
nome: $(this).find("nome").text(),
nomeParlamentar: $(this).find("nomeParlamentar").text(),
sexo: $(this).find("sexo").text(),
uf: $(this).find("uf").text(),
partido: $(this).find("partido").text(),
gabinete: $(this).find("gabinete").text(),
anexo: $(this).find("anexo").text(),
fone: $(this).find("fone").text(),
email: $(this).find("email").text(),
//comissoes: $(this).find("comissoes").text(),,
print_name: function () {
console.log(this.nome);
}
};
deputado.print_name();
deputados.push(deputado);
});
};