如何在 Hubspot Messenger().运行() 消息关闭后重新加载 window?

How to reload window after Hubspot Messenger().run() message closes?

我正在编写一个 MVC 应用程序,我真的需要在消息(错误和成功)关闭后重新加载 window。 我怎样才能做到这一点?

实际上,我在点击按钮时尝试使用此代码,但没有成功:

    Messenger().run({
        successMessage: 'Record Removed!',
        errorMessage: 'Error',
        progressMessage: 'Removing record...',
        events: {
            "click": function () {
                window.location.reload();
            }
        }
    }, {
        method: 'DELETE',
        url: $(this).data('url'),
        error: function (jqXHR, textStatus, errorThrown) {
            return errorThrown;
        }
    });

要测试的 CodePen:http://codepen.io/larissa/pen/rjOpRM/

不确定,但试试这个

   Messenger().run({
        successMessage: 'Record Removed!',
        errorMessage: 'Error',
        progressMessage: 'Removing record...',
        events: {
            "click": function () {
                window.location.reload();
            }
        }
    }, {
        method: 'DELETE',
        url: $(this).data('url'),
        error: function (data) {
                 location.reload();
        },
        success: function (data) {
               location.reload();
         },

    });

我决定更改此解决方案的方法。感谢@codenut 的帮助! 使用此代码对我有用。

$(document).on('click', 'button.deleteButton', function (e) {
    var urlDelete = $(this).data('url');
    var table = $('#' + $(this).data('grid')).DataTable();

    Messenger().run({
        successMessage: 'Row removed!',
        progressMessage: 'Removing row...'
    }, {
        method: 'DELETE',
        url: urlDelete,
        error: function (jqXHR, textStatus, errorThrown) {
             return errorThrown;
        },
        complete: function () {
            table.ajax.reload();
        }
    });
});