I am trying to overwrite the success function upon ajaxsend event but it doesnt work here is the code:
$(document).ajaxSend(function(event,xhr,options){
You could use closures to accomplish what you need:
function closure(handler) { return function(ev, xhr, options) { console.log("start"); handler(ev, xhr, options); console.log("stop"); } } $(document).ajaxSend(closure(function(ev, xhr, options) { console.log("hello"); }));