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

未关闭
#1,113 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
35/100
Issue 类型
文档
描述清晰度
基本清楚
活跃度
停滞
技术栈
jquery
领域
documentation

调研方向

从 $.ajax() 文档开始,重点查看 error 设置及其 errorThrown 参数的说明。协调关于该参数类型的引述内容,并记录 HTTP/2 下 statusText 为空的限制;当预期值和该限制都明确无歧义时,工作即告完成。

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
HTML
星标
324
派生
259
平均合并
1 天 30 分钟
30 天内合并 PR
1

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

jquery/api.jquery.com 的其他 Issue

查看 jquery/api.jquery.com 的全部 Issue

相似的 Issue

更多 Documentation Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。