gpt4 book ai didi

jquery - 为什么 jQuery 将包含空内容的 200 响应 Ajax 请求视为失败()?

转载 作者:行者123 更新时间:2023-12-03 22:03:03 25 4
gpt4 key购买 nike

首先,根本不存在跨区域问题。

我发现如果服务器响应一个空的内容主体,jQuery 认为这是失败()?

这是为什么?

最佳答案

如果您使用 jQuery >= 1.9,则空 JSON 响应将被拒绝,根据 API documentation :

The JSON data is parsed in a strict manner; any malformed JSON is rejected and a parse error is thrown. As of jQuery 1.9, an empty response is also rejected; the server should return a response of null or {} instead.

关于jquery - 为什么 jQuery 将包含空内容的 200 响应 Ajax 请求视为失败()?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19353083/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com