title: Example of jQuery Deferred method for executing code in order
body: <p>I've never used jQuery $.Deferred and so far I haven't found an example I can get my head around. </p>
  
  <p>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.</p>
  
  <p>I'm trying the following but seem to be getting anywhere:</p>
  
  <pre><code>        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();
  </code></pre>
  
  <p>Does anyone have something simple working in a fiddle?</p>