表格数据未在for循环内创建。示例代码`
var SelectedIndex = $(this).index();
$.getJSON('QueryPhpFile.php?requ=getshopcategory&ShopId='+ShopId[SelectedIndex], function(data)
{
$('#id_div_Item').show();
$('#id_div_Item').empty();
var table='<table>';
$.each(data.JsonArray, function(key, val)
{
table=table+'<tr>';
table=table+'<td class="id_td_ItemHeader">';
table=table+val.vc_CategoryName;
table=table+'</td>';
table=table+'</tr>';
$.getJSON('QueryPhpFile.php?requ=getshopitem&ShopId='+ShopId[SelectedIndex]+'&CategoryId='+val.vc_CategoryId, function(data)
{
$.each(data.JsonArray, function(key, val)
{
console.log("ItemNames" + val.vc_ItemName);
table=table+'<tr>';
table=table+'<td class="id_td_ItemHeader">';
table=table+val.vc_ItemName;
table=table+'</td>';
table=table+'</tr>';
});
});
});
$('#id_div_Item').append(table);
$('#id_div_Item').append('</table>');
});`
此行未到来。只有下面循环部分之前的行才会出现。任何想法或建议来纠正这个。感谢
console.log("ItemNames" + val.vc_ItemName);
table=table+'<tr>';
table=table+'<td class="id_td_ItemHeader">';
table=table+val.vc_ItemName;
table=table+'</td>';
table=table+'</tr>';