Reputation: 1995
Any way to get beforeSend()
to work like done() and fail() with $.ajax ?
$.ajax(..).beforeSend(function(){
// do things before send
}).done(.....
Upvotes: 0
Views: 450
Reputation: 12039
You can add beforeSend:
like success:
. The event inside beforeSend:
function works before starting AJAX. This should work
$.ajax({
url: 'your_url',
data: your_data,
type: 'get',
dataType: 'your data type',
success: function(data){
//Do after success
},
beforeSend: function(){
//Do before ajax starting
},
complete: function(data){
//Do after completing
}
});
Here include details.
Upvotes: 1