I've never used jQuery $.Deferred and so far I haven't found an example I can get my head around.
What I need is to be able to perform 3 separate tasks in order, step 1, step 2 and step 3. Step 2 should wait for step 1 to complete and step 3 should wait for step 2 to be complete before executing.
I'm trying the following but seem to be getting anywhere:
var construct = new $.Deferred();
construct.done(function() {
console.log('Step 1');
});
construct.done(function() {
setTimeout(5000);
console.log('Step 2');
});
construct.done(function() {
console.log('Step 3');
});
construct.resolve();
Does anyone have something simple working in a fiddle?