the problem was that i was calling a function (one click) and then nothing triggered. I change the code and now it's working super! here you can check it out:
View:
Is the same that in my question, but only changed the modal name to "myModal".
Js File:
$('#myModal').on('show', function() {
var id = $(this).data('id'),
username = $(this).data('usern');
$('#myModal .modal-body p').html("Desea eliminar al usuario " + '<b>' + username + '</b>' + ' ?');
})
$('.confirm-delete').on('click', function(e) {
e.preventDefault();
var id = $(this).data('id');
var user = $(this).data('title');
$('#myModal').data('id', id).modal('show');
$('#myModal').data('usern', user).modal('show');
});
$('#btnYes').click(function() {
var id = $('#myModal').data('id');
$.ajax({
url: 'deleteFrontUser',
type: 'POST',
data: 'id='+id,
success: function(html){
$('[data-id='+id+']').parents('tr').remove();
$('#myModal').modal('hide');
}
});
return false;
});
What i also did, was to add "data-title" atribute in the html, like this:
<td><a href="#" class="confirm-delete btn mini red-stripe" role="button" data-title="{$frontuser->username}" data-id="{$frontuser->id}">Eliminar {$frontuser->id} {$frontuser->username} </a></td>
data-title stores the username so jquery can sustract it later. Please notice that i'm using smarty template engine.
Hope this can help newbies like me :)