I need to make a modal exclusion commit.
No html
<a class="btn btn-primary" onclick="Confirmar(<?=$dados->id;?>)">Excluir</a>
The function
<script>
var base_url = '<?php echo base_url() ?>';
function Confirmar(id_registro) {
bootbox.confirm({
message: 'Confirma a exclusão do registro?',
callback: function (confirmacao) {
if (confirmacao) {
$.post(base_url + 'index.php/ProspectoCrmController/deletar',{
id_registro: id_registro
}, 'json');
bootbox.alert('Registro excluído com sucesso.');
}else {
bootbox.alert('Operação cancelada.');
}
},
buttons: {
cancel: {label: 'Cancelar', className: 'btn-default'},
confirm: {label: 'EXCLUIR', className: 'btn-danger'}
}
});
}
What happens? the id passed by the delete button, arrives without errors in the confirm function, but in the $ .post (base_url ... is not passing, arrives in the controller but without the id