jQuery Simple Example
JavaScript
console.log('jquery version: ' + $.fn.jquery);
var parent = jQuery.Deferred();
var child = parent //
.then(callback)
.fail(errorCallback);
parent.resolve( "foo" );
console.log('finished');
function callback(arg){
console.log('callback called with "' + arg + '"');
throw 'my error';
}
function errorCallback(arg){
console.log('error callback called with "' + arg + '"');
return "bar";
}