Hi All,
I created my own post function. It is basically an extension of the ajax post function:
function custompost(args) {
var onDone = function () {
if (!specialcondition) {
console.log('an error has occurred!!! abort! abort!');
}
}
var req = $.post.apply(this, Array.prototype.slice.call(arguments));
req.done(onDone);
return req;
}
The problem is the following. When I call my function:
custompost(url, data, onSuccess);
var onsuccess = function() {
console.log('success');
}
the 'onSuccess' function is called before than the 'onDone' function. How can I change the order of execution and avoid the 'onSuccess' function to be called?
Thank you very much and sorry my English :)