views:

26

answers:

1

Hi,

I want a function to be triggered on every ajax request is sent from a document, and another function to trigger when that request is completed.

This code is to be independent with the code which triggers the ajax request.

I remember it can be done in prototypeJS easily, but I haven't done this in jquery.

Thanks

+3  A: 

Use ajaxSetup

$.ajaxSetup({
    success: yourmethod
});

For details on the settings available for $.ajaxSetup(), see $.ajax().

BrunoLM
I would use these .ajaxStart( handler() ) and .ajaxComplete(). Thanks
Moe Sweet