9 ms·
I don't know much about browser-side javascript, but unless they're doing something really weird in the event loop I believe the comments // this might exe
by russell_h 16y ago
I don't know much about browser-side javascript, but unless they're doing something really weird in the event loop I believe the comments
// this might execute before the $.get() above is complete
and
// something additional to execute upon success, which might, or might not,
// have fired by now. With $.ajax deferreds built-in, it doesn't matter.
are misleading. In fact, the first comment should read "this will execute before the $.get() above is complete" and the second one should read "which will not have fired yet".
Someone please correct me if I'm wrong on this.
- mrkurt 16y agoYou're not wrong in terms of the sample code, but in general the "success" method might be called after the request is complete. It's like the "ready" event in jQuery, you're meant to use that even after the DOMReady has fired.
- ehynds 16y agoNot if things are in the cache, especially in IE. In this case the xhr will complete almost immediately.