2
Hello, I need to modify this function to use callback as a function return and not as a new function call via callback.
I need it this way because I am creating a generic method for exclusion confirmations in the existing system. If I don’t succeed like this, it will generate me a lot of changes in the application.
I am using the JS Bootbox library and the method is:
function Confirm(messageOfConfirmation){
bootbox.confirm({
message: messageOfConfirmation,
buttons: {
confirm: {
label: 'Yes',
className: 'btn-success'
},
cancel: {
label: 'No',
className: 'btn-danger'
}
},
callback: function (result) {
functionOfCallback(result);
}
});
}
And to reinforce and avoid understanding of duplicity in the question, follow an example of how I intend to use.
function PodeExcluir(){
if(Confirm("Tem certeza que deseja excluir?"){
//Chamada de exclusão aqui
}
}
I mean, today the system already uses the JS standard confirm but need to change.