jQuery global ajax error handler fires before "local" one -


i want handle 401 errors globally , deal other errors locally. locally means inside fail handler ajax call.

to that, implemented ajaxerror handler on document. however, problem local fail handler triggered before global one. event.stopimmediatepropagation() inside global handler useless.

how can make global 1 fired first , prevent local 1 firing @ all. thank you.

    var statuscodeerror = function(error) {         throw new error('--> error code ' + error.status + ' on xmlhttprequest');     };     var settings = {         type        : 'post',         url         : '/ajax-script.php',         datatype    : 'json',         context     : document.body,         statuscode  : {             404: statuscodeerror,             301: statuscodeerror,             302: statuscodeerror,             401: statuscodeerror,             500: statuscodeerror         }, failure : statuscodeerror     };      $.ajaxsetup(settings); 

Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -