I'm doing an MVC app and need to do a reload after the message close (successful or not). How can I do this?
CodePen for testing: link
HTML:
<button class="btn btn-danger deleteButton" id="btnAction" data-url="https://jsonplaceholder.typicode.com/posts/1">
Click me
</button>
JavaScript:
$(function () {
//Messenger options
Messenger.options = {
extraClasses: 'messenger-fixed messenger-on-bottom',
theme: 'flat',
messageDefaults: {
showCloseButton: true,
scrollTo: true
}
};
$(document).on('click', 'button.deleteButton', function (e) {
Messenger().run({
successMessage: 'Registro removido com sucesso!',
errorMessage: 'Error',
progressMessage: 'Removendo registro...',
events: {
"click": function () {
window.location.reload();
alert("Reload!");
}
}
}, {
method: 'DELETE',
url: $(this).data('url'),
error: function (jqXHR, textStatus, errorThrown) {
return errorThrown;
}
});
});
});