PHP 파일을 요청하고 있습니다. 응답은 .done (function (msg) {});으로 처리됩니다. .fail이 작동합니다. 하지만 때로는 요청에 오류가 발생합니다. 나는 이것을 재 시도했다. 재 시도도 가능합니다.성공한 아약 재시도 없음 .done
var request = $.ajax({
url: "wcf.php",
type: "POST",
dataType: "xml",
async: false,
timeout: 5000,
tryCount: 0,
retryLimit: 3,
data: { barcode: value, curPrxID: currentPrxID, timestamp: (new Date).getTime()},
error: function (xhr, ajaxOptions, thrownError) {
if (xhr.status == 500) {
alert('Server error');
}
this.tryCount++;
if (this.tryCount < this.retryLimit) {
$.ajax(this);
//return;
}
}
}) ;
그리고 : 처음에 실패하고 드에 성공한다면 2 ~ 3
내 요구를 (I가 성공했는지 볼 수 있습니다 불을 지르고에서) 내 request.done 화재를하지 않습니다 시도 이것은되는 .done이고 실패 :
request.done(function(msg)
{
$(msg).find("Response").each(function()
{
// my code here
});
});
request.fail(function(jqXHR, textStatus, errorThrown)
{
$("#message").html(errorThrown);
});
고마워요! 이런 식으로 생각하지 않았습니다. – Annaspaz