参数errorThrown是什么数据(jQuery的错误回调函数的第三个参数) 是服务器(后端已经编写的,在我的例子中是一些用 Java 编写的基于 REST 的服务)必须返回的东西,还是更通用的东西,它是“自动”返回的,无需添加一些东西代码中的错误处理?
最佳答案
嗯,来自jQuery.ajax()
s documentation :
Type: Function( jqXHR jqXHR, String textStatus, String errorThrown ) ... When an HTTP error occurs, errorThrown receives the textual portion of the HTTP status, such as "Not Found" or "Internal Server Error."...
因此,errorThrown
字符串对应于任何失败响应的 HTTP 状态响应 (>399) 对于 400,它将是 Bad Request
,500:内部服务器错误
等...
关于javascript - errorThrown jquery 错误回调函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20859769/