0
I have the following Ajax/Jquery to delete a record as an action of a href.
<script type="text/javascript">
function apagarRegistro(idTel) {
var baseurl = '<?php echo $sig_url;?>';
$.ajax ({
url: baseurl+"/sistel/index/apagar?idRegistro="+idTel,
type:'POST',
success:function(res){
if (res != 'success') {
alert("Registro apagado com sucesso.");
history.go(0);
}
}
});
}
</script>
The problem I’m having is that after I make a query on the first page (of the pagination) when I click to delete the file and the same is done successfully, I want to be given the refresh on the page but it presents the message to confirm as print there:
What would be the solution to this?
Why you need to give the refresh? If it is to update the deleted record it would be better to update by own ajax.
– Franchesco
Yeah, somehow I messed up then. Because the code should do it. What happens is that if I don’t refresh the record, it doesn’t go away. #buguei
– phpricardo
If the table where the record is being called via ajax, just call the function that creates it again.
– MarceloBoni
If the data is in a table, just delete the row on which the deleted file stood. It all depends on how you are presenting this data.
– Franchesco
I don’t understand well, in my case I’m using Zend and I have a method in the model that makes delete.
– phpricardo
Shows the code where Voce mounts the table to better elucidate the question
– MarceloBoni
The way to bring data is normal with foreach.. the line that does delete action is the one that as loop has the ID of each record: <?php href="javascript:eraserRegistro(<? php echo $res->idTelefone;?>)" ?>
– phpricardo