重新加载页面一次,然后再重新加载,不改变内容


Reloads page once then reloads again without content change

我有一点javascript,张贴到php,每秒钟,检查一个时间表,基本上返回"刷新",如果满足开始时间,然后返回刷新,当满足结束时间。

如果"refresh",它会重新加载页面。

function checkSchedules(){
  if(sch_timer)
    clearInterval(sch_timer)
 $.ajax({
  url:'checkSchedule_test.php?mediaID='+mediaIDArray[schCount],
  type:'GET',
  complete: function (response) {
       if(response.responseText == "refresh"){
           location.reload(true);
       }          
  },
  error: function () {
      alert('Sorry there was an error!');
  },
})
sch_timer = setTimeout(checkSchedules,1000);
schCount = (schCount >= urlArray.length - 1)? -1 : schCount
++schCount
}
php 中的

if ($current_date>=$startDate && $current_date<=$endDate){
    if ($current_time >= $startTime && $current_time <= $endTime){
 $timeout = $endTime - $current_time;
 if ($current_time >= $startTime && $current_time <= ($startTime+3000)){
    echo "refresh";
 }
if($timeout<=3000){
    echo "refresh";
}
    }
}

当满足开始时间时,刷新很好,工作很好。然后,当满足结束时间时,它刷新,但内容相同。点击刷新就可以了

我已经尝试了不同的方法重载()(文档。重载等)

有人有什么想法吗?

欢呼

使用console来理解从服务器返回的内容

使用debug()console.log()来理解php返回的是什么…重新加载脚本是正确的问题将在ajax