加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

KNP Paginator并可与ajax一起排序

发布时间:2020-12-16 02:45:51 所属栏目:百科 来源:网络整理
导读:是否可以简单地使用ajax运行knp paginator?是否可能,最好的方法是什么? 问候迈克尔 解决方法 不确定这是否是最佳解决方案,但我是这样做的: $(function(){ $('#dish-select-component-canvas').on('click',"ul.pagination a",function(e){$.ajax({ type: "
是否可以简单地使用ajax运行knp paginator?是否可能,最好的方法是什么?

问候迈克尔

解决方法

不确定这是否是最佳解决方案,但我是这样做的:

$(function(){ $('#dish-select-component-canvas').on('click',"ul.pagination a",function(e){
$.ajax({
    type: "GET",url: $(this).attr('href'),})
    .done(function( msg ) {
        $('#dish-select-component-items').html(msg);
    });
e.preventDefault();
});

});

#dish-select-component-canvas是页面的容器.当有人在ul.pagination的链接上点击这个画布时(分页是由knpPaginator默认使用的类作为分页的包装器),我接受该链接的href属性,并使用ajax GET请求发送它.该请求的结果将转到相应的div(此处为#dish-select-component-items).当然,您必须记住添加e.preventDefault()以防止浏览器重新加载页面.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读