Disabling some jQuery global Ajax event handlers for a request

It’s possible and not difficult to do.

You just need to setup your global error handler (.ajaxError) to receive a few of the parameters that jQuery can provide to it:

$("div.log").ajaxError(function(evt, xhr, settings) {
    if(settings.suppressErrors) {
        return;
    }

    // Normal processing
});

After this, you can add suppressErrors: true to the settings of any AJAX request you make, and if it fails the error handler will return without doing what it normally does.

See it in action.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)