News for hackers. Stuff that matters.
Re:jQuery 4.1.0 by noduerme on Tuesday November 17, 2026 @05:31PM (#50539208)
fetch only became available in 2015 and it was awhile before it was commonly supported. At the time, jQuery's ajax was much nicer than handling the XMLHttpRequest yourself. I have sites that have gone through all three, finally replacing $().ajax with fetch only in the last couple years.
Re:jQuery 4.1.0 by xp84 on Tuesday November 17, 2026 @11:12PM (#50541781)
That’s gotta be it. I think the older parts of the codebase definitely either predated 2015 or straddled the time where you couldn’t assume fetch was there. And I agree, XHR was actually pretty absurd, having used it in about 2006 before discovering JQ.
Re:jQuery 4.1.0 by noduerme on Wednesday November 18, 2026 @03:48AM (#50543646)
Yeah. And also, 2015 was the same time when Promises became part of the spec. That was the justification for fetch in the first place. So, $().ajax still handled its results with callbacks, it wasn't async, although it was easy enough to wrap. You wouldn't necessarily replace it until you were ready to rewrite a whole bunch of other stuff in your code with async functions. For me, a bigger question for older code was transitioning the bulk of the code to promise patterns, even though I would've otherwise wanted to swap fetch for ().ajax much sooner.