X Tutup
The Wayback Machine - https://web.archive.org/web/20200529215407/https://github.com/airbnb/javascript/pull/1465
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use fetch over $.ajax #1465

Open
wants to merge 1 commit into
base: master
from
Open

Use fetch over $.ajax #1465

wants to merge 1 commit into from

Conversation

@graingert
Copy link
Contributor

graingert commented Jun 23, 2017

No description provided.

@oshalygin
Copy link
Contributor

oshalygin commented Jun 23, 2017

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.

@graingert
Copy link
Contributor Author

graingert commented Jun 23, 2017

hardly any browser

73% usage relative...

@oshalygin
Copy link
Contributor

oshalygin commented Jun 23, 2017

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

@ljharb ljharb added the editorial label Jun 23, 2017
Copy link
Collaborator

ljharb left a comment

fetch, unpolyfilled, is absolutely not broadly available enough.

However, airbnb-browser-shims polyfills it, and this guide strongly encourages you to always use it in browsers (and airbnb-js-shims in node).

Regardless, $.ajax is still a valid approach for those using jQuery, so while we may want to also add fetch examples, we would definitely not want to remove the jQuery examples.

@ljharb
Copy link
Collaborator

ljharb commented Jun 23, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.
X Tutup