[英]run function if success ($.ajax) has 200 status code?
I would like to use success
and run function only if has 200 status code I have see only this example: 我仅在具有200个状态代码的情况下才想使用
success
并运行功能,我仅看到以下示例:
$.ajax ({
success: function(data,textStatus,jqXHR){
external();
}
)};
But i never see a really code example i would like the if status code is 200 is run an external function 但是我从来没有看到一个真正的代码示例,我想如果状态代码为200运行外部函数
PS before i tried to use easy success (without arguments) and error, but error worked also if the external file was ok.. PS在我尝试使用简单成功(无参数)和错误之前,但如果外部文件正常,错误也可以工作。
Sorry for my english 对不起我的英语不好
The success
event is called when the request succeeds ( documentation ). 请求成功时将调用
success
事件( documentation )。 The textStatus
parameter should contain the string '200'
or any other status number your server returned. textStatus
参数应包含字符串'200'
或服务器返回的任何其他状态编号。
I hope the code you posted is partial: I don't see the url, method, etc. which should be passed as parameters to $.ajax
. 我希望您发布的代码是局部的:我看不到url,方法等应作为参数传递给
$.ajax
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.