title: jquery 1.5.1 Deferred Object .when() .then() Confusion
body: <p>I have two webmethods returning dates from a .net 3.5 page.<br>
  Each return a start and end date string, respectively.<br>
  I try calling them and then outputting their results after they both complete as an alert as a simple test, yet I cannot do this successfully.<br>
  When I step through my code, the alert is displayed before the global vars are filled.  Once the alert is displayed, the vars are filled. 
  What am I doing wrong?</p>
  
  <pre><code>&lt;script type="javascript"&gt;
  var startDate, endDate;
  
  $(document).ready(function(){
     $.when(GetStartDate(), GetEndDate()).then(Output());
  });
  
  function GetStartDate(){
     return $.ajax({
     type="POST",
     url="myurl/page.aspx/GetStartDate",
     data = {},
     contentType="json",
     success: function(data){ startDate = data.d.toString();},
     failure:failureAlertMsg
    });
  }
  
  function GetEndDate(){
     return $.ajax({
     type="POST",
     url="myurl/page.aspx/GetEndDate",
     data = {},
     contentType="json",
     success: function(data){ endDate = data.d.toString();},
     failure:failureAlertMsg
    });
  }
  
  function Output(){
      alert('StartDate: ' + startDate + '\nEndDate: ' + endDate');
  }
  &lt;/script&gt;
  </code></pre>