Specifically, how does it differ from the default (async: true)? In what circumstances would I want to explicit set async to false, and does it have something to do with preventing other events on the page from firing?
+1
A:
If you disable asynchronous retrieval, your script will block until the request has been fulfilled. It's useful for performing some sequence of requests in a known order, though I find async callbacks to be cleaner.
John Millikin
2009-09-25 16:33:58
So it would do what an alert box does before you dismiss it, stop any script from running until the request completes?
Joe D
2009-09-25 16:37:44
Joe: that would depend on whether you have any worker threads in the background.
John Millikin
2009-09-25 16:44:32
+5
A:
Does it have something to do with preventing other events on the page from firing?
Yes.
Setting async to false means that the statement you are calling has to complete before the next statement in your function can be called. If you set async: true then that statement will begin it's execution and the next statement will be called regardless of whether the async statement has completed yet.
For more insight see: http://stackoverflow.com/questions/1457690/jquery-ajax-success-anonymous-function-scope
Sean Vieira
2009-09-25 16:36:02