homepage Welcome to WebmasterWorld Guest from 54.163.89.8
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

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

5+ Year Member



 
Msg#: 4462198 posted 9:01 pm on Jun 6, 2012 (gmt 0)

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,

 

daveVk

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 4462198 posted 6:10 am on Jun 8, 2012 (gmt 0)

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.

nelsonm

5+ Year Member



 
Msg#: 4462198 posted 12:07 pm on Jun 8, 2012 (gmt 0)

what's the idea behind async:false being depreciated anyway?

Fotiman

WebmasterWorld Senior Member fotiman us a WebmasterWorld Top Contributor of All Time 5+ Year Member



 
Msg#: 4462198 posted 1:53 pm on Jun 8, 2012 (gmt 0)

[bugs.jquery.com...]

enigma1

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 4462198 posted 1:57 pm on Jun 8, 2012 (gmt 0)

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.

nelsonm

5+ Year Member



 
Msg#: 4462198 posted 3:53 pm on Jun 8, 2012 (gmt 0)

ok, thanks....

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved