Is it possible to process a JSON response from a Server in jQuery.ajax(), before the complete or error is executed?
Or let me extend the question:
While processing the JSON data (each response property), tell $.ajax() if it is a success and complete AJAX request, or it is an error, so $.ajax({error: function() {} }); is executed?
Example Psuedocode:
$.ajax({
    url: 'script.php',
    type: 'POST',
    data: {some: 'data-1'},
    dataType: 'json',
    process: function(data) {
        if(data.success == true && (data.data.length > 0)) {
            this.success = true;
        } else {
            this.success = false;
        }
    },
    success: function() {
        if( this.success == true ) {
            // it was a success
        }
    },
    error: function() {
        if( this.success == false ) {
            alert('there was an error');
        }
    }
});
Why you might ask? Because I want to use a single $.ajax() syntax everywhere, and only $.ajax({ process: function(data) {} }); should be altered from time to time.
 
     
     
    