Welcome to WebmasterWorld Guest from 54.205.209.95

Forum Moderators: open

Message Too Old, No Replies

Do i need $.ajax async:false if using success: callback function?

   
9:01 pm on Jun 6, 2012 (gmt 0)

5+ Year Member



Hi all,

I was looking over my code and noticed that i had jquery .ajax methods that had the async:false setting in a few javascripts.

So i looked it up on the jQuery site and it said that As of jQuery 1.8, the use of async: false is deprecated. Why would it be depreciated?

I'm not sure i even need async:false, doesn't using a callback function as the success setting value negate the use of async:false?

thanks,
6:10 am on Jun 8, 2012 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



Provided the code following the ajax call does not rely on the completion of the ajax, the async:false can be removed, such code should be in the callback.
12:07 pm on Jun 8, 2012 (gmt 0)

5+ Year Member



what's the idea behind async:false being depreciated anyway?
1:53 pm on Jun 8, 2012 (gmt 0)
1:57 pm on Jun 8, 2012 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



It's because synchronous requests can lock up the ajax state and browser. IMO it should been like this from the beginning and have the code serialize the ajax requests if necessary.
3:53 pm on Jun 8, 2012 (gmt 0)

5+ Year Member



ok, thanks....

I changed all my scripts to remove the potential problem and every thing still works.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month