3 ms·
I don't have anything against jQuery, but isn't it a bit weird to have that be the example in 2020? Wouldn't `fetch` just work fine there...?
by Klonoar 6y ago
I don't have anything against jQuery, but isn't it a bit weird to have that be the example in 2020? Wouldn't `fetch` just work fine there...?
- scubbo 6y agoTIL!
- aaronpk 6y agoI'd happily accept a PR to the docs! I launched this service in... 2012
- zoover2020 6y agoThis is what I love about HN and puts a smile on my face every damn time. For some reason, it makes the whole internet with its billions of users feel so small, for a sharp and brief moment. Of course we live in our own bubble on HN, so it's quite a specific and targeted demographic already, but still.
- Klonoar 6y agoWell, now I look like an ass. :) I was assuming this was a new thing - my mistake! Makes much more sense now, haha.
- throwanem 6y agoNow you have one! (I fixed a typo and added a note about the presence of a CORS header on responses, too.)
- SimeVidas 6y agoYes but it’s worth mentioning that jQuery Ajax is a high-level API while `fetch` is a low-level method. The default call is sometimes (most of the times?) not what you want, and you have to add one or more options.
- throwanem 6y agoIt's not any more complicated to use than $.ajax ever was; the major difference is that it returns promises by default instead of needing callbacks, and that's a strict improvement. That said, I'm glad you gave me a reason to look at the jQuery docs again, for the first time in years. What a 2009 mood! edit: And if I'd looked more closely, I'd have seen that $.ajax now does return a promise. So that's good! Still appreciate the nostalgia hit.
- abraham 6y agojQuery is still used on a huge number of sites. > jQuery alone is found on nearly 85% of the mobile pages tracked by HTTP Archive https://almanac.httparchive.org/en/2020/javascript#what-do-we-use https://almanac.httparchive.org/en/2020/javascript#what-do-w...