I finally found a simple way to do it :-) The issue was not really about the complexity of the JS function, but I could not find how to hook to the onError call. Here a solution: onError: ( 'alert(xhr.status); alert(thrownError);' asFunction: ( Array with: 'xhr' with: 'ajaxOptions' with: 'thrownError' ) ) ); Thierry