4 ms·
But how would you call this API from the browser synchronously? I guess in theory there is a synchronous XHR call but I’ve never seen it used. That could be som
by ErikAugust 6y ago
But how would you call this API from the browser synchronously? I guess in theory there is a synchronous XHR call but I’ve never seen it used. That could be something you add to the problems.
- Izkata 6y agoIn the early days of ajax proliferation, I remember reading blog posts where people recommended synchronous XHR to keep your code linear, instead of trying to understand callbacks, which would make the code too complicated.
- bradleybuda 6y agoObviously crazy advice that the current generation of Javascript programmers was wise to disregard. /s
- idreyn 6y agoWell, yeah. You have one thread to work with in the browser, and if you tie it up with a synchronous XHR your application freezes until the request finishes.
- cortesoft 6y agoSynchronous XHR calls were not that uncommon back in the day.
- baron816 6y agoYikes
- imtringued 6y agoBy googling "jquery synchronous ajax". Here is the first result: https://stackoverflow.com/a/6685294 https://stackoverflow.com/a/6685294 Although I don't recommend doing this it's hardly as difficult as your comment implies.
- ErikAugust 6y agoNot hard, but certainly wrong and deprecated as far as I can tell.
- manquer 6y agoDeprecated Only in the main Thread , using in web worker is a perfectly valid and acceptable use
- sreekotay 6y agoOn its way out... but.... synchronous XHR still works. https://xhr.spec.whatwg.org/ https://xhr.spec.whatwg.org/