Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/454.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/287.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript jQueryAjax——有时我得到响应,有时没有响应?_Javascript_Php_Jquery_Ajax - Fatal编程技术网

Javascript jQueryAjax——有时我得到响应,有时没有响应?

Javascript jQueryAjax——有时我得到响应,有时没有响应?,javascript,php,jquery,ajax,Javascript,Php,Jquery,Ajax,这是我的Ajax函数(用于轮询),包装在$(document).ready中。每秒钟都应该向update.php发送一个请求 (请注意,getParameterByName和ArrayIndexists是我自己的函数) 这是我在update.php中看到的内容: header('Content-type: application/json'); $game = $_POST["game"]; $returnArray = array(); // do stuff with the data...

这是我的Ajax函数(用于轮询),包装在
$(document).ready
中。每秒钟都应该向
update.php
发送一个请求

(请注意,
getParameterByName
ArrayIndexists
是我自己的函数)

这是我在
update.php中看到的内容:

header('Content-type: application/json');
$game = $_POST["game"];
$returnArray = array();
// do stuff with the data......
echo json_encode($returnArray);

当它工作时(比如说60%的时间),控制台中每隔一秒左右就会出现类似的内容:

但当它不工作时,控制台中根本不会显示任何内容

显然,请求仍在发送中,只是没有响应:


昨天我花了一上午的时间试图找出问题所在,但我不知道我做错了什么,也不知道如何让它在100%的时间内正常工作。谢谢。

如果您没有收到响应,说明您的服务器有问题。请检查服务器上的PHP或Apache日志。@Barmar抱歉,您指的是哪个日志?当前我正在使用XAMPP(localhost),您是说
\XAMPP\apache\logs\error.log
?对不起,我不知道XAMPP中的特定日志文件位置。这听起来可能是正确的地方。@Barmar我不确定我应该在日志中查找什么,但我发现有很多这样的错误:
[Fri Dec 11 08:58:06.638165 2015][ssl:warn][pid 6524:tid 408]AH01909:www.example.com:443:0服务器证书不包含与服务器名称匹配的ID
但我不太确定它的真正含义。
header('Content-type: application/json');
$game = $_POST["game"];
$returnArray = array();
// do stuff with the data......
echo json_encode($returnArray);