With jQuery and I need help getting individual table row titles attributes from an xml file
- by bfsarmi
I'm usig tablesorter jQuery to parse this xml file
<?xml version="1.0" encoding="iso-8859-1"?>
<CATALOG>
<CD>
<TITLE>Title 01</TITLE>
<ARTIST>Artist 01</ARTIST>
<COUNTRY>Country 01</COUNTRY>
<PRICE>10.00</PRICE>
<YEAR>2010</YEAR>
<INFO>Tooltip Info 01</INFO>
</CD>
<CD>
<TITLE>Title 02</TITLE>
<ARTIST>Artist 02</ARTIST>
<COUNTRY>Country 02</COUNTRY>
<PRICE>9.00</PRICE>
<YEAR>2009</YEAR>
<INFO>Tooltip Info 02</INFO>
</CD>
<CD>
<TITLE>Title 03</TITLE>
<ARTIST>Artist 03</ARTIST>
<COUNTRY>Country 03/COUNTRY>
<PRICE>8.00</PRICE>
<YEAR>2008</YEAR>
<INFO>Tooltip Info 03</INFO>
</CD>
</CATALOG>
and with this code
<script type="text/javascript">
$(document).ready(function(){
$.ajax({
type: "GET",
url: "file.xml",
dataType: "xml",
success: function(xml){
$(xml).find("CD").each(function(){
$("#tablebody").append('<tr><td>'
+ $(this).find("TITLE").text()
+ '</td><td>'+ $(this).find("ARTIST").text()
+ '</td><td>'+ $(this).find("COUNTRY").text()
+ '</td><td>'+ $(this).find("PRICE").text()
+ '</td><td>'+ $(this).find("YEAR").text()
+ '</td></tr>');
});
}
});
});
</script>
I'm new at javascript and have been trying with no luck for a couple of hrs to get the text from the INFO/INFO tags in the xml file to show as title attributes for each table row. The reason for that is that I need to have individual popup tooltips on mouse-over each table row.
Many Thanks in advance for any kind of help or suggestions!