I'm loading xml and then getting data with js. My question is every time I need to find an attribute do I have to execute a function?
$(document).find("Item").each(function(){
}
I want to say
$(document).find("Item").eq(0).attr("title")
However this only works when I place it in the function
function parse(document){
}
This is my xml
$.ajax({
url: 'data.xml',
dataType: "xml",
success: parse,
error: function(){alert("Error: Something wrong with XML");}
});
document.