jQuery ordered actions
<p>Does anybody know how to make a jQery function that has more than one action and every action will be fired only after its precedent is complete like:</p>

<pre><code>$('#myelement').addClass('loading').load(loadUrl).removeClass('loading');
</code></pre>

<p>here the first action which is adding the class name is ok, the second is also ok, but the problem comes with the last action which is supposed to remove the class after the load is finished, but here it will be fired even before the loading is finished and will cancel the first action so that it will look like none of the first nor the third action are present.</p>

<p>Thanks.</p>
