Hello,
I'm attempting to iterate through a response from a jQuery Ajax request (returned as XML).
With that response, I'm building an HTML table with 3 columns (capable of an unlimited number of rows). Once the 4th XML node/ "company" is found, it should start a new row in the table. Any help with the JS to determine when the new row should be added is most appreciated. Thanks!
JS example:
/* jQuery Ajax Call here */
success: function(xml){
var trow = $("<tr>");
$(xml).find("Company").each(function(index){
var cellData = "<td width=\"33%\" valign=\"top\" ><div class=\"container\">"+
"<div class=\"item\"><a href=\"#\" title=\"\" target=\"\">"+ $(this).attr("Name")+ "</a></div>"+
"<div class=\"description\">"+ $(this).attr("Description") + "</div></div></div></td>";
$(cellData).appendTo(trow);
});
trow.appendTo('#tbl');
}
});
});
Example XML response from web service:
<Companies>
<Company ID="6" Name="Company name 1" Description="Lorem ipsum" />
<Company ID="22" Name="Company name 2" Description="Lorem ipsum" />
<Company ID="28" Name="Company name 3" Description="Lorem ipsum" />
<Company ID="31" Name="Company name 4" Description="Lorem ipsum" />
</Companies>