JQuery取消加载事件

JQuery取消加载事件,jquery,html,Jquery,Html,在JQuery中,是否可以在对html元素进行任何更改之前取消.load 例如: $(".userElementsList").load("/userList/addNewUser", params, function (responseText, textStatus, jqXHR) { try { var response = $.parseJSON(responseText); alert(response.m

在JQuery中,是否可以在对html元素进行任何更改之前取消.load

例如:

$(".userElementsList").load("/userList/addNewUser",
    params,
    function (responseText, textStatus, jqXHR) {
        try {
            var response = $.parseJSON(responseText);
            alert(response.message);
            $(". userElementsList").off();
        } catch (error) {
            cleanningUserPopupData();
            $("#userPopup").modal("hide");
        }
    }
);

我有一个带有表格的页面和一个允许创建用户的弹出窗口,当用户点击创建时,上面的代码就会被执行。如果没有任何错误,它应该返回一个html内容来构建页面中的users表,但如果出现任何错误,它将返回一个json内容,并在弹出窗口中显示错误。

try catch应该做什么?不要使用load,使用Ajax方法自己获取并设置HTML。