passing an array of jquery get requests into $.when()
<p>I have the following parameters:</p>

<pre><code>a = [{param:'a'}, {param:'b'}, {param:'c'}]
</code></pre>

<p>I'd like to make a get request for each parameter, like this:</p>

<pre><code>a.map(function(ai){return $.get('myapi/get?ai='+ai.param)})
</code></pre>

<p>How do I do something once all the get requests have finished?</p>

<p>I have tried using $.when, like this:</p>

<pre><code>$.when(
    a.map(function(ai){return $.get('myapi/get?ai='+ai)})
)
.done(function(results){
    results.forEach(function(ri, i){
        ri.success(function(result){
            a[i].result = result
        }
    }
    do_something_with(a)
}
</code></pre>

<p>unfortunately I am clearly misunderstanding this <code>$.when().done()</code> idiom as when I call <code>do_something_with(a)</code> I don't have the new <code>.result</code> attribute. I'm guessing it's because <code>when</code> is seeing a single array and so just passes straight into the <code>.done()</code>, as opposed to waiting for each component <code>get</code> to finish. </p>

<p>Any help would be appreciated!</p>
