1

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

1 Answer 1

3

Use ajaxSetup

$.ajaxSetup({ success: yourmethod }); 

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

Sign up to request clarification or add additional context in comments.

1 Comment

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.