I would contend there aren't many instances where you'd want to set XMLHttpRequest to synchronous mode... although Eric is of course correct, if your employer says so, do it
Failing that though, I think what people *do* more often come up against is not wanting more than one AJAX request processing at a time, which is synchronous in a sense too, but not the same way. In this situation you see things like setting and checking flags before sending a new request, locking out the submit button on the UI, things like that. That tends to come up more often.
Can I say it doesn't make sense to use AJAX in synchronous mode?
The whole purpose of Ajax is Async then under which scenario we should set this false parameter?
Joined: Dec 16, 2004
Hi Rajan... I think the cases where it might be desirable to make a synchronous call are when you absolutely have to ensure other code doesn't execute before the response is returned... maybe you have some timer code that can't fire until the response is received. Might make sense then. It's also an easy way, although I'd contend a poor way, to guard against multiple simultaneous AJAX requests, which is sometimes desirable.
I agree though, I can't myself think of a case where it really does make more sense than other options, but just because I can't come up with a scenario doesn't mean there aren't any