1
I tried to do it this way, however, I have several records within a repeat loop, the value of the id I can pick up is last on the list. How do I get the value of the record individually.
function confirmacao() {
var resposta = confirm("Realmente deseja remover esse usuário?");
if (resposta == true) {
var url = "teste.php?id=" + "<?php echo $id; ?>";
window.location.href = url;
}
}
<div class="modal-footer">
<div class='col-sm-5 text-right' style="float: right;right: auto;left: 14px;">
<button type='button' class='btn btn-danger' onclick="confirmacao(this)">Excluir</button>
</div>
</div>
I got it this way:
function confirmacao(id) {
var resposta = confirm("Realmente deseja remover este usuário?");
if (resposta == true) {
var url = "teste.php?id=" + id;
window.location.href = url;
}
}
<div class="modal-footer">
<div class='col-sm-5 text-right' style="float: right;right: auto;left: 14px;">
<button type='button' class='btn btn-danger' onclick="confirmacao('<?php print $id; ?>')">Excluir</button>
</div>
</div>