ajax全局处理程序的例外情况

时间:2014-09-21 05:39:08

标签: jquery ajax asp.net-mvc-4 global

我在母版页中使用了这个ajax设置。现在在每个ajax操作上出现加载。 有时候我不想显示装载情况。我怎样才能从全局处理程序中逃脱? 感谢

var AjaxGlobalHandler = {
Initiate: function (options) {
    $.ajaxSetup({ cache: false });

    // Ajax events fire in following order
    $(document).ajaxStart(function () {
        $.blockUI({
            message: options.AjaxWait.AjaxWaitMessage,
            css: options.AjaxWait.AjaxWaitMessageCss
        });
    }).ajaxSend(function (e, xhr, opts) {
    }).ajaxError(function (e, xhr, opts) {
        //if (options.SessionOut.StatusCode == xhr.status) {
            //document.location.replace(options.SessionOut.RedirectUrl);
            //return;
        //}

        $.colorbox({ html: options.AjaxErrorMessage });
    }).ajaxSuccess(function (e, xhr, opts) {
    }).ajaxComplete(function (e, xhr, opts) {
    }).ajaxStop(function () {
            $.unblockUI();
        });
    }
};

0 个答案:

没有答案
相关问题