For example I have general code for catching json, that says - "its error request". This code is in ajaxComplete, how can I stop executing specific code from ajaxComplete point?
$.post('url', params,
function(json){
if (json.success == false){
alert('error')
}
if (json.success == true){
alert('success')
}
}, 'json'
);
Instead of this code in each ajax request, I want to use something like:
$().ajaxComplete(function(e, xhr){
if (json.success == false){
stop_execution_of_post()
}
if (json.success == true){
proceed_execution_of_post();
}
}
Than in post, you would only to write this:
$.post('url', params,
function(json){
alert('success')
}, 'json'
);
Is that possible to STOP from execution SPECIFIC ajax function?