I\'m trying to create a global handler that gets called before the ajax success callback. I do a lot of ajax calls with my app, and if it is an error I return a specific st
This solution transparently adds a custom success handler to every $.ajax() call using the duck punching technique
$.ajax()
(function() { var _oldAjax = $.ajax; $.ajax = function(options) { $.extend(options, { success: function() { // do your stuff } }); return _oldAjax(options); }; })();