dsz90288 2018-07-22 22:39
浏览 44

Java / AJAX进程在开发框上工作但在远程Web服务器上没有

This Javascript code...

      var xmlhttp = new XMLHttpRequest();
      xmlhttp.open("GET", "get_status.php");
      xmlhttp.send();
      xmlhttp.onreadystatechange = function() {

        if (this.readyState === 4 && this.status === 200) {
            test_response = JSON.parse(this.responseText);

            console.log(test_response[0]);
            console.log(test_response[1]);

...calls this php code...

        $result = pg_query('select max(num_files), max(file_num) from status');
        $num_files = pg_fetch_row($result);

if ($num_files[0] === $num_files[1] ) {
    pg_query('truncate table status');
}

echo json_encode($num_files);

Note the console.log statements in the first code snippet. At run time, the console is showing values of "null" for both of these values.

But the "status" table has non-null values in it so I'm not sure what is going on.

Additionally, this code is running fine on development machine in case that is a clue, i.e. something in php.ini or postgres configuration file?

Another clue might be that the "status" tables is not getting truncated as it should, i.e. something going on with array or logic?

Also, the purpose of the code above is to determine status of data processing that is happening in a separate php file on uploaded files. So could be something related to multiple postgres connections being handled on servers vs on development machine?

Lastly, I have worked my way through and corrected all console and server log warnings and am no longer getting any warnings and also all other parts of the process are working correctly. Just this one status process is not working correctly.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 2020长安杯与连接网探
    • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
    • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
    • ¥16 mybatis的代理对象无法通过@Autowired装填
    • ¥15 可见光定位matlab仿真
    • ¥15 arduino 四自由度机械臂
    • ¥15 wordpress 产品图片 GIF 没法显示
    • ¥15 求三国群英传pl国战时间的修改方法
    • ¥15 matlab代码代写,需写出详细代码,代价私
    • ¥15 ROS系统搭建请教(跨境电商用途)