dongpan8928 2014-05-01 19:49
浏览 132

重新加载页面然后重新加载而不更改内容

I have a bit of javascript that posts to a php, every second, which checks a schedule and basically returns "refresh" if the start time is met then returns refresh when the end time is met.

if "refresh" it reloads the page showing what its suppose to.

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
}

in the 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";
}
    }
}

when the start time is met it refreshes fine, works great. then when the end time is met it refreshes but the contents the same. if I hit refresh it works fine.

I've tried different methods of reload() (document.reload, etc...)

Has anyone got any ideas?

Cheers

  • 写回答

1条回答 默认 最新

  • donglin6109 2014-05-01 19:58
    关注

    use console to understand what is returning from server

    use debug() or console.log() for understand what is returning from php ... reload script is correct issue will be during ajax

    评论

报告相同问题?

悬赏问题

  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看