Suppose that I have some global Ajax event handlers defined (ajaxStart, ajaxStop, and ajaxError). Usually I am fine with that, but for one request, I want to disable the ajaxError handler but still run the ajaxStart and ajaxStop handlers as usual. The jQuery ajax function documentation mentions the "global" parameter that can be set to false and passed to the $.ajax function to disable all global Ajax event handlers, but they don't mention any way to only disable some global handlers.
I can prevent the ajaxError handler by doing a test on the "url" property of the ajaxSettings object that is passed to the ajaxError function, but that seems somewhat clumsy. Does anyone here know of a way to disable the ajaxError function from running that would be clear to someone looking
at the place where the $.ajax function is being called?
I can provide a simple example if anyone wants to see it.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…