jQuery - Prevent further code execution until after html has been displayed
<p>I am using the <a href="http://www.xarg.org/project/jquery-webcam-plugin/" rel="nofollow">jquery webcam plugin</a> with the flash save method. I want set a message after the user clicks save so they know it's saving. My code is this:</p>

<pre><code>$('#savepicmessage').html("Saving picture, please wait");
webcam.capture();
webcam.save('/savephoto.php');
</code></pre>

<p>The problem is that the "Saving picture" message only gets displayed after the picture is saved. Is there a way to prevent execution of the code following the .html("Saving picture, please wait") call, so that it is not executed until the message has been displayed?</p>

<p>I can achieve it with a setTimeout and have the capture and save in the function called from there, however this is not reliable enough.</p>

<p>I looked at .when and deferred.then but that didn't seem to work.</p>
