2010-08-18 67 views
0

我有一張表,返回搜索結果。當用戶搜索其他內容時,存在相同的結果,並且該表只是在不刪除先前的搜索的情況下填充數據。這全部在JSON結果操作上,沒有回傳,因此不會重新加載頁面。當頁面刷新時,我得到一張空表。我嘗試使用下面的代碼。如何從填充表中刪除表格行(第一行除外)?

$('searchTable').find("tr:gt(0)").remove(); 
$('searchTable').children('tr:not(:first)').remove(); 
$('searchTable td').parent().remove(); 

下表

<table id="searchTable"> 
    <tr> 
     <th>Name</th> 
     <th>Address</th> 
     <th>IdNumber</th> 
     <th>Status</th> 
     <th>Date</th> 
    </tr>   
    <tr> 
     <td class="name"></td> 
     <td class="address"></td> 
     <td class="idNum"></td> 
     <td class="status"></td> 
     <td class="date"></td> 
    </tr> 
</table> 

如何刪除以前的搜索結果之前,我去我的JSON迴應嗎?

回答