<table id="myTable" style="width: 650px;">
<tbody>
<tr style="font-weight: bold;">
<td>Name</td>
<td>Price</td>
<td>Supplier</td>
<td>Amount</td>
<td>Basket</td>
</tr>
</tbody>
</table>
is my HTML.
这是我目前的“贱民共同倡议”:
$.post( /ajax/products , { method: search , string: searchstring, category: $( #search_category ).val() }, function(data) {
data = $.parseJSON(data);
$( #myTable > tbody:last ).append( <tr><td> +b.name+ </td><td> +b.price+ </td><td></td><td></td></tr> );
});
});
Each time you key up, the above js executes. Now when you are looking for Cookies, and you starts to write, it sends a ajax post with "C" then "Co" then "Coo" etc.
Already at the first ajax call it has found results that are starting with C. Therefore it appends to the table. Now it also found results for "Co" (same results as "C", because theres only Cookies in the db at the moment).
同科奥、库克群岛、库克群岛、库克群岛、库克群岛一样,......你们也站在了。 结果是各表的档次。
So what i wish to do is like cleaning/removing the <tr>
s thats inside #myTables
tbody, before it appends (actually just before the $.post()).
但是,它不应去掉第一个<代码><tr>,正如你在我前面的html中看到的那样,该编号为一栏标题。
How can i do this?