Doing a table fill with AJAX, I was trying to use $('#maintable').append() multiple times in a loop, assuming that the append function is just appending whatever text I supply to it - but it turns out jQuery append actually appends a child element to the parent element. The above syntax is for jQuery and not plain javascript.
I was ending up with content like
<tr></tr>
<tr></tr>
<tr></tr>
<td>Our data</td> ... and so on.
So, I must append an entire row with a single append statement. In javascript, the function call can span multiple lines, no problem. Most probably the correct way would be to use maintable.tbody.append, though the snippet below works.
function showThings(things) {
}
No comments:
Post a Comment