[jQuery] rewriting generic ajax jQuery style
Ok, here's another question.... I've got this code working:
$(document).ready(function() {
$('#resultcontainer').accordion();
$("dt").click(function(){
idsource = $(this).attr("id");
$.ajax({
type: "GET",
url: "getItems.php",
data: {cat_id: idsource},
dataType: "xml",
success: function(xml){
//build a table from xml results.
var output = '<table><thead><tr><th>Items Available</th></tr></thead><tbody>';
//create rows for each result.
$("item_id", xml).each(
function() {
var linkId = $(this).text();
output += '<tr>';
output += '<td>'+$(this).text()+'</td>';
output += '<td><a href="itemdetail.php?item_id='+linkId+'" >'+$(this).siblings().text()+'</a></td>';
output += '</tr>';
}
)
output += '</tbody></table>';
$('#itemtable'+idsource).html(output);
}
})
})
});
I just looked for a "nextSibling" style analouge in jQuery. Would it be more benificial to change the node I am getting out of the XML file and grab both its children? or is this method ok?. Which one would be faster? Selecting two children? or selecting siblings?
Thanks,
-Jim
.-*** Message Scanned by Alachua County McAfee Webshield Appliance ***-.
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/