title: passing data from .when to .then in jQuery
body: <p>I'm trying to use a <code>.when</code> with an <code>.each</code> to loop through some elements and <code>.then</code> do something with the results. But I'm not sure how to store the results from the <code>.when</code> to use in the <code>.then</code>.</p>
  
  <p>for example</p>
  
  <pre><code>var widget_data = [];
  
  $.when(
      $.each(widget_ids, function(index, widget_id){
          $.get('/widget/' + widget_id, function(data){
              widget_data.push(data);
          });
      })
  )
      .then(function(){
          console.log(widget_data);
      });
  </code></pre>
  
  <p>The widget_data array is empty after running.</p>