0

Which is the fastest in terms of milliseconds to get results from the page being loaded? $.get(link, function(r) { }); or $.get(link).done(function(r) { }); or $.get(link).success(function(r) { });

Sam
  • 85
  • 10
  • 1
    I believe you won't get any measurable difference, but you can find out for yourself here: http://jsperf.com/. Note that the last one (`success`) is *deprecated*. – Felix Kling Sep 22 '14 at 04:15
  • I feel like this question is ambiguous. The time it takes to load information is based on the server's processing of whatever request you send to it via the `$.get()` method. If the query is static, then I imagine that perhaps the first one will be the fastest as the 'success' function is given immediately, instead of deferred to the promise object given the `$.get(link)`. Also, I don't think there should be any difference between `.done()` and `.success`, to the best of my current knowledge, `done` is just the current version of the deprecated `success`. – Jhecht Sep 22 '14 at 04:15
  • so would `.done` be the best option? – Sam Sep 22 '14 at 04:17
  • performance difference is negligible, instead choose over each other based on other stuff. read: http://stackoverflow.com/questions/8840257/jquery-ajax-handling-continue-responses-success-vs-done – ariel Sep 22 '14 at 05:18

0 Answers0