我有这个 html,它是 php 的输出。
...
...
<tr valign='top'>
<td>1</td>
<td class="parent">
<a href="http://127.0.0.1/ci/index.php/admin/menus/edit/1">Main menu
</a></td>
<td align='center'>active</td>
<td align='center'>0</td>
<td class="parent" >0</td>
<td align='center'></td>
<td align='center'>
<a href="http://127.0.0.1/ci/index.php/admin/menus/edit/1">edit
</a> | <a href="http://127.0.0.1/ci/index.php/admin/menus/deleteMenu/1" class="delete_link" id="delete_link_1">delete
</a></td>
</tr>
<tr valign='top'>
<td>68</td>
<td class="child">
<a href="http://127.0.0.1/ci/index.php/admin/menus/edit/68">Forsiden
</a></td>
<td align='center'>active</td>
<td align='center'>1</td>
<td class="child" >0</td>
<td align='center'>forsiden</td>
<td align='center'>
<a href="http://127.0.0.1/ci/index.php/admin/menus/edit/68">edit</a> |
<a href="http://127.0.0.1/ci/index.php/admin/menus/deleteMenu/68" class="delete_link" id="delete_link_68">delete
</a></td>
</tr>
...
...
当您单击删除链接时,我想删除、隐藏和向上滑动 tr 之一。我创建了以下 jquery。它会删除 DB 中的数据,但不会向上滑动并隐藏已删除的行。
谁能告诉我我在做什么错误和正确的代码。
$('.delete_link').live('click', function(eve){
eve.preventDefault();
if(confirm('Are you sure you want to delete this page?'))
var id = this.href.match(/[^\/]*$/);
this.id = 'http://127.0.0.1/ci/index.php/admin/menus/deleteMenu/' + id;
$.post(this.id, function(){
$('#delete_link_'+id)
.closest('tr')
.slideUp('slow',function(){
$(this).remove();
});
});
});