Here's a great blog post from Doug Crockford, one of the gods of Javascript
on the subject:

""""
Many people prefer to use it synchronously. When used this way, the
JavaScript engine is blocked until the interaction with the server is
complete. Because it blocks, the flow of control looks a lot like an
ordinary function invocation. Temporal complexity is abstracted away,
leaving a very familiar and comfortable programming pattern. It works
particularly well when the server is on the same machine, or nearby on the
LAN. Unfortunately, it can perform very badly if the server is under heavy
load, or if the browser is connected to the server over a slow link. Because
the JavaScript engine is blocked until the request completes, the browser
will be frozen. The user cannot cancel the request, cannot click away,
cannot go to another tab. This is extremely bad behavior.

Fortunately, XMLHttpRequest provides an option for asynchronous operation.
When you set the asyncFlag flag to true, the JavaScript engine does not
block. Instead the request returns immediately, with a potential action that
will be triggered later when the result on the request is known.
""""

Callbacks are your friend, and give you the same functionality as
synchronous calls without the downside :)

Chris
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to