I’m using jQuery ajax to do some requests to the server. I have to add some validations after the content is loaded (error handling). The easiest way is by adding the validation on the success() callback. However, I would need to implement that callback in all the implementations I already have. Is there a way to extend the success callback? Something that will be called before the rest of the callback code? This way I can add the validations for each success in ONE place, and be executed every time a success callback is called.
I tried preFilters, converters, but they don’t fit my needs.
From
jQuery.ajax:So, something like this should work
Though you will still have to modify some code.