我有3页,涉及Ajax,step1.php,step2.php和step3.php:
step1.php
<head>
$.ajax({
type: "POST",
url: "step2.php",
data: dataString,
success: function(data) {
} // end function
}); // end ajax
</head>
<body>
<?php
// PHP codes
?>
step2.php
<head>
$.ajax({
type: "POST",
url: "step3.php",
data: dataString,
success: function(data) {
} // end function
}); // end ajax
</head>
<body>
<?php
$_SERVER['HTTP_X_REQUESTED_WITH'] = Isset($_SERVER['HTTP_X_REQUESTED_WITH']) ? strip_tags($_SERVER['HTTP_X_REQUESTED_WITH']) : $_SERVER['HTTP_X_REQUESTED_WITH'] = Null;
if(!$_SERVER['HTTP_X_REQUESTED_WITH'])
{
require_once '../Error/404.php';
}
else
{
$taken_time_start = time();
$num = Isset($_POST['num']) ? trim(intval(abs($_POST['num']))) : $num = Null;
$id_ism = Isset($_POST['id_ism']) ? trim(intval(abs($_POST['id_ism']))) : $id_ism = Null;
$Start = Isset($_POST['Start']) ? trim(intval(abs($_POST['Start']))) : $Start = Null;
$End = Isset($_POST['End']) ? trim(intval(abs($_POST['End']))) : $End = Null;
$nums = $End - $Start;
if($nums < 2) {
// echo 'please choose at least 3 s<br />';
$hideButton = 'false'; // hide show button
} else {
$cSel = 'SELECT * FROM results WHERE s_ism = "'.$id_ism.'"';
//echo $aSel.'<br />';
$cReq = $connexion->query($cSel);
$cRes = $cReq->fetchAll();
if($cRes){
echo 'yes there is';
} else {
echo 'no';
}
}
} // end HTTP_REQUEST
等等,我的问题是:我可以使用jSON在step1.php处理中获得step2.php的结果吗?
谢谢大家