Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
558 views
in Technique[技术] by (71.8m points)

javascript - ajax响应在活动服务器上返回空,但在本地主机上具有值(ajax response returns empty on live server but has value on localhost)

my ajax file returns value on my local host but when I uploaded it on live server it returns an empty array.

(我的ajax文件在本地主机上返回值,但是当我将其上传到实时服务器上时,它返回一个空数组。)

this is what's inside the file my ajax/jquery calls

(这是我的ajax / jquery调用的文件里面的内容)

include '../../components/db.php';
$res_date = $_POST['res_date'];

 $query = "SELECT t.timeasd from time t left join (select time_reserved, date_reservation from RESERVATIONS where date_reservation = '$res_date') as q on t.timeasd = q.time_reserved where q.date_reservation is null AND t.status='active'";
 $result = mysqli_query($conn, $query);
 $timeslots=array();
 while ($myrow=mysqli_fetch_assoc($result))
      {
        $timeslot=$myrow['timeasd'];
        array_push($timeslots,$timeslot);
      }
 echo json_encode($timeslots);

it worked when I changed the query to

(当我将查询更改为)

SELECT * from time

but I am using the former query on my localhost database and it works perfectly

(但是我在我的本地主机数据库上使用前一个查询,它运行完美)

  ask by reve berces translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...