lovespring
lovespring

Reputation: 19589

Before every ajax request using jQuery, I want to do sth

means, do sth, then request using jQuery, like a hooker. How can i do this?

Upvotes: 0

Views: 123

Answers (1)

Nick Craver
Nick Craver

Reputation: 630599

Use $.ajaxSetup() for this

Full documentation here

For example:

$.ajaxSetup({
    beforeSend: function() {
       //do something, like show 'Requesting....'
    }
});

Upvotes: 2

Related Questions