0
I’m trying to delete records without having to refresh the page, but I’m not succeeding, the records erase but the table only updates if I give an F5, I’m trying to do this via ajax but it’s not rolling, can someone give me a light? Here I have the delete registration button and I pass the id
<li>
<a onclick="excluirLancamento(<?= $user->id ?>)"><i class="fa fa-trash" aria-hidden="true"></i> Excluir</a>
And here the javascript
<script type="text/javascript">
function excluirLancamento(id) {
if (confirm('Tem certeza que deseja excluir este registro?')) {
$.ajax({async:true, type:'post',
complete:function(request, json) {
$('#caixa').html(request.responseText);
excluirTr('registro'+id);
},
url:'/users/delete/'+id
});
} else { return false; }
}
remembering that I am importing jquery correctly
<script src="/webroot/js/jquery-3.2.1.min.js"></script>
The problem would be in function
excluirTr('registro'+id);
not excluding rows in the html table?– Juven_v
It deletes the line, but I have to give an F5 to update the table, I wish it doesn’t need to be updated, I don’t know is correct the way I’m doing it
– Henrique