dongxiequ3724 2016-05-24 14:01
浏览 37
已采纳

响应PHP为空

I use jquery to call two url in file indexFunctions.php but the response of server is empty i dont know why please help there is my code

$("#start_peering").submit(function(event){
    $("#wait").html('<img src="ajax-loader.gif">');
    event.preventDefault();
    $.ajax({
            url : 'indexFunctions.php',
            type : 'POST',
            data : {peering:true},
            success : function(data){
                    $("#StbStatus").html(data);
                    $.ajax({
                            url : 'indexFunctions.php',
                            type : 'POST',
                            data : {test_params:true},
                            success : function(data){
                                    $("#results").html(data);
                                    $("#wait").html('');
                                    }
                             });


            }
    });

});

File indexFunctions.php

$rpi="http://192.168.1.15";

  if (isset($_POST['peering']) && isset($_POST['test_params']))
{   
  $url = $rpi."/peering.php?askSTB=true";
  $response = proxy::get($url);
  echo $response;   
  $url = $rpi."/installUSBKeyOnStb.php";
  $response = proxy::get($url);
  echo $response;

 }

 ?>

Thank you in advance.

  • 写回答

2条回答 默认 最新

  • dongzuo9096 2016-05-24 14:03
    关注

    You seem to be sending two request but checking if both are set at the same time.

    if (isset($_POST['peering']) && isset($_POST['test_params']))
    

    You should check for either or not both.

    Try changing it to:

    if (isset($_POST['peering']) || isset($_POST['test_params']))
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 access中怎么分割分别获取一下图中的值
  • ¥15 keras_tcn已经安装成功,还是显示ModuleNotFoundError: No module named 'keras_tcn'
  • ¥15 类图中关联与聚合的区别
  • ¥15 ENVI高分五号去除云层的方法
  • ¥15 16进制数据如何得到奇偶校验位
  • ¥15 求合并两个字节流VB6代码
  • ¥15 Pyqt 如何正确的关掉Qthread,并且释放其中的锁?
  • ¥30 网站服务器通过node.js部署了一个项目!前端访问失败
  • ¥15 WPS访问权限不足怎么解决
  • ¥15 java幂等控制问题