0
我有一个jQuery ajax调用去服务器backend.php脚本并告诉睡眠13秒(或更多),然后再用一个简单的测试信息。我看到的是在10秒后触发ajax成功函数(在萤火虫中观察到200响应),但没有来自服务器的实际响应。如果我将响应延迟设置为小于10秒,我会完美地收到响应消息。Ajax jQuery在10秒后成功返回,当它不应该
这是你以前见过的东西吗?有一些默认的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(假定秒)...... – 2011-03-04 18:21:13
@ Dan Twining,通常关于时间的数字是指**毫秒** – Shoe 2011-03-04 18:24:10
好吧,好吧......我尝试设置“set_time_limit(35);”在我的后端脚本中,并得到消息“警告:set_time_limit()由于安全原因已被禁用......”我有一个与streamline.net共享的托管帐户,所以我猜测没有任何东西我能做些什么呢? – 2011-03-04 18:30:07