Parsing through XML
Parsing through XML
Hi, everything works up until the point where I try to parse through the data. I want to grab the ID of the element that is clicked, and then use that to find the correct data in my xml file.
-
$(document).ready(function() {
$(".servicelinks").click(function() {
var pos = $(this).attr("id");
$.ajax({
url: "Services.xml",
dataType: "xml",
success: function(data) {
// Parsing happens here
$(data).find("id").each(function() {
$(this).find(pos).each(function() {
var sName = $(this).find("Name").text();
alert(sName);
});
});
}
}); /*.ajax*/
}); /*.servicelinks.click*/
}); /*document.ready*/