1
Hello, I do an xml request, and I get a tag called item, with some unconventional attributes
$.ajax({
type:"GET",
dataType: 'text',
url : "requests/playlist_jstree.xml",
success: function(retorno){
parser = new DOMParser();
xmlDoc = parser.parseFromString(retorno,"text/xml");
var lista=xmlDoc.getElementById("plid_2").getElementsByTagName("item");
console.log(xmlDoc.getElementById("plid_5").uri);
},
error: function(e){
}
});
This plid_5 is inside plid_2, I could have accessed it as well:
console.log(lista[0].uri
But neither of the two can access this attribute called Uri, in fact the only attribute that works is id, the other attributes do not access, as I do to access the value of these attributes?
What gives
console.log(retorno);
?– Sergio
Open the browser console and write js code directly there. You can even inspect the variable
lista
and see all its contents, methods and attributes.– Jefferson Quesado
JS is a language of Duck Typing, which means the language doesn’t care about strong signatures/content, everything will depend on how the object was built and fed
– Jefferson Quesado