Can calling a complex function inhibit $.when?
<p>I have a function:</p>

<pre><code>function someFunction(params) {
//Creates an object
//$.each(collection, funct() { /*do work on collection, essentially pushes items into an array */});

//JSON.stringify(results)

//$.ajax POST...this is what I want $.when to wait for

}
</code></pre>

<p>I setup</p>

<pre><code>$.when(someFunction(params)
).then(doNextThing);
</code></pre>

<p>I also tried</p>

<pre><code>$.when(function() {someFunction(params) }
).then(doNextThing);
</code></pre>

<p><code>doNextThing</code> is invoked before the callback.  Is it possible that <code>$.each</code> or <code>stringify</code> is causing <code>$.when</code> to fail?</p>
