I want to merge the onComplete callBack with another function before
pass it off to an ajax call(eg. Request.HTML).
I tried the following code, but it produced an infinite loop(halted
after like 10 recursive calls to onComplete).
I understand why, but is there a solution to simply create a function
F that executes what's already in options.onComplete, then execute the
second function, and then pass F as the onComplete callBack?
thanks
function mergeFunction(f1, f2){
return function(){
f1.attempt(arguments);
f2.attempt(arguments);
};
}
options.onComplete=mergeFunction(options.onComplete, function(){
func2();
});