0
jQuery ajax 호출이 서버 backend.php 스크립트로 전달되고 간단한 테스트로 응답하기 전에 13 초 (또는 그 이상) 동안 잠들 것을 말했습니다. 메시지. 내가보기에는 서버로부터의 실제 응답없이 10 초가 지난 후 아약스 성공 함수가 (방화 광에서 관찰 된 200 응답으로) 트리거됩니다. 응답 지연을 10 초 미만으로 설정하면 응답 메시지가 완벽하게 수신됩니다.Ajax jQuery가 10 초 후에 성공적으로 반환되어야 함
이전에 본 적이 있습니까? 어떤 PHP PHP는 시간 초과 일이 있습니까?
ajaxcall = $.ajax({
type: "GET",
url: "backend.php",
async: true,
cache: false,
dataType: 'json',
timeout: 30000,
/* Timeout in ms. Default to 30000 (30 seconds) */
data: "TimeStamp=" + TimeStamp,
success: function(data) {
if (data !== null) {
$('#TextHistory').append(data.message);
if (data.timestamp != 0)
{
TimeStamp = data.timestamp;
}
}
setTimeout(
waitForMsg, /* Request next message */
5000 /* ..after 5 seconds, default to 5000*/);
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
$('#TextHistory').append('<p>Error:' + errorThrown + '</p>');
setTimeout('waitForMsg()',"15000"); /* milliseconds (15seconds) default to 15000 */
}
});
} 서버 측에서
.. 그리고 나는 단지이 일을 해요 :
<?php
header('Content-Type: application/json');
sleep(13); // Changing this to test it. Will only work if less than 10
$When = date("H:i:s",strtotime("now"));
$response["message"] = "<p>Small Test $When</p>";
$response["timestamp"] = 123456789;
echo json_encode($response);
?>
Hi..thanks, 분명히 max_execution_time이라는이 (초 가정) ... –
를 30로 설정 @ Dan Twining, 일반적으로 시간에 관한 숫자는 ** 밀리 초를 나타냅니다 ** – Shoe
ok, 글쎄 ... 나는 "set_time_limit (35);"설정을 시도했습니다. 백엔드 스크립트에서 "경고 : set_time_limit()이 보안상의 이유로 비활성화되었습니다."라는 메시지가 나타납니다. streamline.net과 공유 호스팅 계정을 가지고 있으므로 아무 것도 없다고 생각하고 있습니다. 내가 할 수있어? –