Bug Tracker

Changes between Version 1 and Version 2 of Ticket #8819, comment 3


Ignore:
Timestamp:
Apr 19, 2011, 3:45:11 AM (12 years ago)
Author:
jaubourg
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #8819, comment 3

    v1 v2  
    11You're right, some browsers will freeze when doing synchronous ajax request. That's why it's been said over and over again that doing synchronous requests is to be avoided at all cost.
    22
    3 In your case, it's not that the browser is frozen before the beforeSend, it's just that the synchronous request prevents the display reflow (which generally happens "sometimes later" than your actual DOM manipulation). I'm pretty confident that, if you try & call showLoader before the call to ajax rather than from inside the beforeSend callback, you'll end up with pretty much the same result.
     3In your case, it's not that the browser is frozen before beforeSend is called (lotsa before in there ;)), it's just that the synchronous request prevents the display reflow (which generally happens "sometimes later" than your actual DOM manipulation). I'm pretty confident that, if you try & call showLoader before the call to ajax rather than from inside the beforeSend callback, you'll end up with pretty much the same result.
    44
    55There is nothing that can be done in jQuery to prevent this behaviour since it is not a jQuery bug (nor a browser one per se, seeing as synchronous xhr requests are supposed to freeze the browser anyway and that nothing says the browser has to carry on with the reflow in that instance).