Good afternoon! I make a request via AJAX to open a modal. I have a dataset ready and I have the option to delete the record from the table. The problem is that whenever I delete a record the page gives refresh and modal date. Is there a way to keep the modal open and delete all the records I wanted without it closing?
The code of the button where I call the modal is this, where the $ records [0] is an id passed to the modal.
<button type='button' class='btn btn-info' style='outline: 0;' onclick='$.fn.del(" . $registos[0] . ")'>Plantel</button>
In the click I make a request via AJAX. The code is this:
$.fn.del = function (id) {
var a = id;
// alert(a);
$.ajax({
url: "del_at_modal.php",
method: "POST",
data: {id: a},
success: function (data) {
$("#form_del_at").html(data);
$("#del_at").modal("show");
}
});
};
The modal that shows the content of this request is
<div class="modal fade" id="del_at" data-backdrop="static">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</span></button>
<h2 class="modal-title">Adicionar atletas à equipa </h2>
</div>
<div class="modal-body" id="form_del_at"></div>
<div class="modal-footer">
<input type='reset' name='cancelar' class="btn" value='Cancelar' />
<button type="submit" class="btn btn-success" name="novos_t">Adicionar equipa técnica</button>
</div>
</div>
</div>
</div>
And in the file, del_at_modal.php, I query the ready table the fields I want and in the end I have this field to delete the record
<td title="Remover atleta da equipa"><a href="el_atleta_equipa.php?cod_atleta=' . $registos[0] . '">X</td>