I have a table that shows student records, and each row has a button to delete the student, and the deletion is done via AJAX. I would like to give a fadeOut on the line that is deleted, so in the AJAX success I did the following:
success:function(){
swal("Excluído!", "O aluno foi removido com sucesso.", "success");
btnExcluir.closest('tr').fadeOut();
}
The problem is that all rows are being removed. I've also tried with parent (). Parent () but the same thing happens anyway.
Here's the snippet from my table:
<tr>
<td>{{$aluno['NM_NIS_ALU']}}</td>
<td>{{$aluno['ST_NOME_ALU']}}</td>
<td class="text-right">{{$aluno['IDADE']}}</td>
<td class="text-center">
<a class="btn btn-primary btn-xs acao" data-toggle="modal" data-target="#modalAluno{{$aluno['ID_ALUNO_ALU']}}"><i class="fa fa-edit"></i> Editar</a>
<a class="btn btn-danger btn-xs acao delete-aluno" data-token="{{csrf_token()}}" data-id="{{$aluno['ID_ALUNO_ALU']}}"><i class="fa fa-times"></i> Excluir</a>
</td>
</tr>
If someone can help me, why is this happening?