我使用jquery在文件indexFunctions.php中调用两个url但是服务器的响应是空的我不知道为什么请帮助我的代码
$("#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('');
}
});
}
});
});
文件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;
}
?>
提前谢谢。
答案 0 :(得分:2)
您似乎发送了两个请求,但检查两个请求是否同时设置。
if (isset($_POST['peering']) && isset($_POST['test_params']))
您应该同时检查两者。
尝试将其更改为:
if (isset($_POST['peering']) || isset($_POST['test_params']))
答案 1 :(得分:-1)
您使用了AND&amp;&amp;而不是OR ||