2016-08-22 15 views
-1

cakephp 3.xでajaxページネーションをより多くのcakephpの方法で実装する方法。cakephp 3.x ajaxページ区切り

cakephp 2.xで、以下のコードを使ってajaxページネーション(JS Helper)を実装しました。

$this->Paginator->options(array('update' => '#content', 'evalScripts' => true)); 

$this->Js->writeBuffer(); 

P1の誰かが私を助けて。

+0

ここにコード付きのライブ例があります:http://sandbox.dereuromark.de/sandbox/ajax-examples – mark

答えて

0

以下のスクリプトを使用して、私はajaxページネーションを行っています。あなたのctpファイルの最後にこのスクリプトを追加してください。

$(document).ready(function() { 
$(".pagination a").bind("click", function (event) { 
    if(!$(this).attr('href')) 
     return false; 
    $.ajax({ 
     dataType:"html", 
     evalScripts:true, 
     success:function (data, textStatus) {$("#content").html(data);}, 
     url:$(this).attr('href')}); 
     return false; 
    }); 

});