I'm looking for a way to trigger ajax error in success callback. i have tried to explain my problem code below:
$.ajax({
url: requestURL,
data: postData,
type: 'post',
success: function(response){
if(response.Success){
// do something
}else{
// request workflow fails in this case,
// i have to trigger this ajax request's error callback
}
},
error: function(){
// do something on error case
},
dataType: 'json'
});
var errorhandler = function(xhr, textStatus, error){
// do something on error case
};
$.ajax({
url: requestURL,
data: postData,
type: 'post',
success: function(response){
if(response.Success){
// do something
}else{
errorhandler();
}
},
error: errorhandler,
dataType: 'json'
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With