2019-03-19 14:55:50 1192次浏览 2条回答 0 悬赏 10 金钱

网上搜的代码

<?= LinkPager::widget(['pagination'=>$pages) ?>
<?php $this->beginBlock('abc'); ?>
<script>

    $(document).on('click','.pagination a',function(e){
        //alert(1111);    没走到这里
        e.preventDefault();

        var url=$(this).attr('href');
        $.get(url,function(msg){
            //alert(msg);
            $('#comment_list').html(msg);
        });
    });
</script>

<?php $this->endBlock();  $this->registerJs($this->blocks['abc'], View::POS_END); ?>
  • 回答于 2019-03-19 15:21 举报

    看看是不是嵌到pjax中了?如果是就把PJAX去掉

    1 条回复
    回复于 2019-03-19 15:43 回复

    我没有用pjax啊 。。。。话说这个是啥

  • 回答于 2019-03-20 13:37 举报

    on('click' 的方法里的最后加上return false;试试
    $(document).on('click','.pagination a',function(e){

        var url=$(this).attr('href');
        $.get(url,function(msg){
            //alert(msg);
            $('#comment_list').html(msg);
        });
        return false;
    });
    
    1 条回复
    回复于 2019-03-25 16:30 回复

    好的 我试一下啊

您需要登录后才可以回答。登录 | 立即注册
筱筱溺水寒
助理

筱筱溺水寒

注册时间:2017-02-15
最后登录:2019-04-18
在线时长:4小时43分
  • 粉丝2
  • 金钱145
  • 威望0
  • 积分185

热门问题