5
I’m making an MVC app and I need to re-load after the message closes (success or not). How can I do this?
Codepen for testing: http://codepen.io/larissa/pen/rjOpRM/
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;
}
});
});
});