所以我试图将Url的数据追加到表头。从URL调用的数据是一个字符串列表。正如你所看到的,我正试图通过列表中的每个值,然后将其附加到我的表头“数据”中。 但是,当我运行代码没有附加任何东西。我知道数据正在进入,因为窗口警报正在显示每个字符串。JQuery:追加到表头
JQuery的:
$(document).ready(function() {
$.ajax({
url: 'http://..../api/Dynamic?table=table1',
dataType: 'Json',
success: function (tableResults) {
var count = 0;
$.each(tableResults, function() {
window.alert(this);
$('#data th:last-child').append('<th><a id="count">' + this + '</a></th>');
count++;
});
}
});
});
HTML:
<table id="data" border="1" align="center" width="95%">
<thead>
<tr>
</tr>
</thead>
<tbody>
</tbody>
</table>
有什么建议?
你......附加一个日到日。这没有意义。 –