dongsonghen9931 2018-01-25 10:32
浏览 70

WordPress:自动刷新特定div

I have a shortcode which usually display scores and schedules of the game. My problem is i want to refresh that specific div #show with shortcode by not refreshing my whole page. Is there anyone can help me out with this situation because I'd search all over the Internet but nothing happens.

below is my header.php of my parent theme

<div id="show" class="little-head-2"><?php echo do_shortcode('[game-widget]');?></div>

See below my attach script:

<script type="text/javascript">
var refreshId = setInterval(function() {
    $('#show').load('#show');
}, 30000);

Please see below screenshot of my header

You can actually visit the site: [http://aseanbasketballleague.com]

  • 写回答

1条回答 默认 最新

  • douqiao1413 2018-01-25 10:34
    关注

    Try this:

    $j(function($) {
    var SANAjax = function(){
      $('#show').fadeOut("slow").load('www.test.com').fadeIn("slow");
    
    }
    setInterval(SANAjax, 10000 );  ///////// 10 seconds 
     });
    </script>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
  • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
  • ¥15 帮我写一个c++工程