I tried to do this as well, however, I have several records inside a repeat loop, the value of the id that I can get is last in the list. How do I get the registry value 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 was able to do the following:
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>