homepage Welcome to WebmasterWorld Guest from 54.205.144.54
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
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




msg:4462200
 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




msg:4462813
 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




msg:4462897
 12:07 pm on Jun 8, 2012 (gmt 0)

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

Fotiman




msg:4462948
 1:53 pm on Jun 8, 2012 (gmt 0)

[bugs.jquery.com...]

enigma1




msg:4462952
 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




msg:4462990
 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