makeAjaxRequest: log all errors, test callback

* All AJAX errors will log to the console
* The onError callback will only be called if defined
This commit is contained in:
Chris Adams 2013-06-26 17:17:50 -04:00
parent 5eccdfee98
commit 1c6a57c710

View File

@ -1321,7 +1321,11 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){
if ( request.status == 200 ) {
onSuccess( request );
} else {
onError( request );
$.console.log("AJAX request returned %s: %s", request.status, url);
if ($.isFunction(onError)) {
onError( request );
}
}
}
};
@ -1335,7 +1339,9 @@ window.OpenSeadragon = window.OpenSeadragon || function( options ){
request.onreadystatechange = function(){};
request = null;
onError( request, e );
if ($.isFunction(onError)) {
onError( request, e );
}
}
},