javascript icon indicating copy to clipboard operation
javascript copied to clipboard

Use fetch over $.ajax

Open graingert opened this issue 7 years ago • 4 comments

graingert avatar Jun 23 '17 12:06 graingert

While good, hardly any browser supports this except everything thats greenfield. IMO its clearer that it stay as $.ajax since most are at least familiar with jQuery AJAX calls, even if they don't use them.

oshalygin avatar Jun 23 '17 16:06 oshalygin

hardly any browser

73% usage relative...

graingert avatar Jun 23 '17 16:06 graingert

73% usage relative...

That may be the case for browsers, but fetch is uncommon in most client code. There are notable disadvantages to using fetch and I would wager that most developers have not used fetch in production.

The guide is meant to be clear and instructive, as opposed to forcing developers to research the fetch API.

https://medium.com/@thejasonfile/fetch-vs-axios-js-for-making-http-requests-2b261cdd3af5

oshalygin avatar Jun 23 '17 17:06 oshalygin

(separately, fetch isn't really meant to be used directly; it's a low-level primitive for libraries to abstract over)

ljharb avatar Jun 23 '17 17:06 ljharb