`.ajax()` documentation unclear about expectations/data type for `errorThrown`

Aperta
#1,113 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
35/100
Tipo di issue
Documentazione
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
jquery
Ambito
documentation

Direzione di ricerca

Inizia dalla documentazione di $.ajax(), in particolare dall'impostazione error e dalla descrizione del relativo parametro errorThrown. Concilia le affermazioni citate sul tipo del parametro e documenta la limitazione di HTTP/2 relativa a un statusText vuoto; il lavoro è completato quando il valore previsto e la limitazione sono privi di ambiguità.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Migrated from jQuery repo: https://github.com/jquery/jquery/issues/4211

Description

There is a seeming contradiction in the documentation for $.ajax().

The docs for the error setting of this function indicate:

... The function receives three arguments: The jqXHR (in jQuery 1.4.x, XMLHttpRequest) object, a string describing the type of error that occurred and an optional exception object, if one occurred...

But later the same docs indicate:

... When an HTTP error occurs, errorThrown receives the textual portion of the HTTP status, such as "Not Found" or "Internal Server Error." ...

In addition, the docs indicate that the type of the parameter is String. But, based on the first sentence, it sounds like it can be either an object or a string; which is it?

Separately, it appears that the errorThrown will always be an empty string for HTTP errors that occur when using HTTP/2 (aka H2). This appears to be because statusText is always an empty string for an HTTP/2 request (more info: https://stackoverflow.com/questions/41632077/why-is-the-statustext-of-my-xhr-empty).

I'd love it for the jQuery team to weigh-in on both of these limitations in the current docs.

Lingua principale
HTML
Stelle
324
Fork
259
Merge medio
1g 30m
PR unite (30g)
1

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di jquery/api.jquery.com

Tutte le issue di jquery/api.jquery.com

Issue simili

Altre issue su Documentation

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.