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

Promote Fetch over XMLHttpRequest and stop using "AJAX" #14157

Closed
hamishwillee opened this issue Mar 22, 2022 · 4 comments
Closed

Promote Fetch over XMLHttpRequest and stop using "AJAX" #14157

hamishwillee opened this issue Mar 22, 2022 · 4 comments
Labels
area: Fetch/XMLHttpRequest Content:Glossary Glossary entries Content:Guide Guide docs Content:WebAPI Web API docs effort: large This task is large effort. help wanted If you know something about this topic, we would love your help!

Comments

@hamishwillee
Copy link
Collaborator

hamishwillee commented Mar 22, 2022

MDN has lots of docs that mention/promote AJAX and explain how it is implemented using XMLHttpRequest.

Two problems:

  1. Fetch should be used instead of XMLHttpRequest because it is a lot simpler and results in better code. On quick scan the only downside of Fetch appears to be that it does not support progress notification (I have not checked if this is true or not in current version). There is a great doc here: https://jakearchibald.com/2015/thats-so-fetch/
  2. AJAX was an early term for using javascript to fetch new data and dynamically update HTML. That is such an accepted pattern now that the term feels very anachronistic and isn't really even needed.

By grep, "XMLHttpRequest" is about 223 files, while "AJAX" (66 files).
I think this is going to be a bit of a project to resolve. There are some easy wins, but in particular the use of XMLHttpRequest is deeply embedded in a lot of docs.

For the Ajax part, would be good to start looking at these entry points:

https://developer.mozilla.org/en-US/docs/Glossary/AJAX

@hamishwillee hamishwillee added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Mar 22, 2022
@sideshowbarker sideshowbarker added Content:WebAPI Web API docs Content:Glossary Glossary entries Content:Guide Guide docs help wanted If you know something about this topic, we would love your help! effort: large This task is large effort. and removed needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. labels Mar 22, 2022
@sideshowbarker sideshowbarker added Content:Glossary Glossary entries and removed Content:Glossary Glossary entries labels Apr 27, 2022
@wbamberg
Copy link
Collaborator

wbamberg commented Nov 18, 2023

References > Developer guides > Ajax
References > Developer guides > Ajax > Getting Started

@Josh-Cena consolidated these in #27568 🎉 .

So I'm looking at https://developer.mozilla.org/en-US/docs/Web/Guide/AJAX and thinking, this just reads like a "how to use XHR" to me, which we already have in https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest_API/Using_XMLHttpRequest.

I guess to me there is a separate meaning of "Ajax" which is not just "how to make HTTP requests from JavaScript" but which is about the whole idea of building a web app around dynamic updates. We cover that in https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Client-side_web_APIs/Fetching_data (which has already been updated to use Fetch).

So between those two, don't we already have good enough coverage of this topic? Can we just delete https://developer.mozilla.org/en-US/docs/Web/Guide/AJAX and redirect to https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Client-side_web_APIs/Fetching_data ?

@hamishwillee
Copy link
Collaborator Author

So between those two, don't we already have good enough coverage of this topic? Can we just delete https://developer.mozilla.org/en-US/docs/Web/Guide/AJAX and redirect to https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Client-side_web_APIs/Fetching_data ?

Yes. I was going to say, "but you should update the AJAX glossary" so the term is captured still, but I see you sorted that already.

@estelle
Copy link
Member

estelle commented Nov 21, 2023

So between those two, don't we already have good enough coverage of this topic? Can we just delete https://developer.mozilla.org/en-US/docs/Web/Guide/AJAX and redirect to https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Client-side_web_APIs/Fetching_data ?

Yes! We talked about this during the #writing-docs meeting earlier today. The consensus: Remove it!

It’s an old guide that doesn’t bring much. A comment should be added to the XHR pages indicating "this was called AJAX" with a link to the AJAX glossary page from that text. Also, we need to ensure glossary term "AJAX" no longer links to this page; instead the glossary page (and all other links that pointed to the guide) get updated so they linkback to the relevant Fetch/XHR pages.

This was referenced Dec 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Fetch/XMLHttpRequest Content:Glossary Glossary entries Content:Guide Guide docs Content:WebAPI Web API docs effort: large This task is large effort. help wanted If you know something about this topic, we would love your help!
Projects
None yet
Development

No branches or pull requests

5 participants