I'd like the XML data to be displayed in a common HTML table with TR
and TD
, because with the code I'm using the information is confusing.
Here is the code I used:
$(function(){
$.ajax({
url : "livraria.xml",
success : function(xml){
$(xml).find("livro").each(function() {
$("#tabela").append(
"Titulo: " +"<br/>"+
"</td></tr>"+ $(this).attr("id") + "-" + "<br/>"+
$(this).text()+"<br>"
);
});
},
error: function(){
alert("Mensagem de erro.");
}
});
});