JSFiddle.net

console.clear()
var deferred = $.Deferred();
var t1= deferred.promise().
then(function(){
console.log("1. çalıştı");
return "ahmet";
}).
fail(function(){
// Sadece aynı dizide hata olduğunda çalışacaklar dizisine eklenen fonksiyon
console.log("1. fail çalıştı");
}).
then(function(){
// üst then içinden return edilen değişkenleri aldığımız fonksyion
console.log(arguments);
console.log("2. çalıştı");
var t = $.Deferred();
setTimeout(function() {
console.log('rejecting...');
t.reject();
}, 1000);
return t.promise();
}).
then(function(){
console.log("3. çalıştı");
console.log(arguments);
}).
fail(function(){
console.log("2. fail çalıştı");
});
t1.then(function(){
console.log("t1. then çalıştı");
}).
fail(function(){
console.log("t1 1. fail çalıştı");
});
deferred.resolve();
console.log("en son satır çalıştı bile");
/*return;
promise1 = deferred.promise();
promise2 = promise1.then(function(){
var t = $.Deferred();
setTimeout(function() {
console.log('rejecting...');
t.reject();
}, 1000);
return t.promise();
});
promise2.then(function() {
console.log('i should never be called');
})
promise2.fail(function() {
console.log('i should be called');
});
deferred.resolve();
*/