看了一下CI的分頁類沒有寫到關於AJAX的內容
在現有的基礎上做了一下小小的改動還是能實現的
下面進入正題
CI的原生分頁類中有一個參數 $config[anchor_class]
這個參數是用來設置分頁鏈接的樣式的
$config[anchor_class] = "class=ajax_fpage";
然後在view部分這樣采用禁止a便簽默認動作的方法來取得AJAX的調取效果
代碼如下
<script>
$(
var url = $(this)
$
$(#show_what_table)
});
event
});
</script>
當ajax_fpage點擊的時候
這樣一個完整的ajax分頁就實現了
詳細的PHP代碼如下
function ContentList($id
{
$this
$config[base_url] = site_url(qyadmin/ContentList/
$config[total_rows] = $this
$config[per_page] =
$config[uri_segment] =
$config[first_link] = FALSE;
$config[last_link] = FALSE;
$config[full_tag_open] = <p>;
$config[full_tag_close] = </p>;
$config[display_pages] = FALSE;
$this
$skin_url = base_url()
$config[next_link] = <img src="
$config[next_tag_open] = <li class="fr">;
$config[next_tag_close] = </li>;
$config[prev_link] = <img src="
$config[prev_tag_open] = <li class="fr">;
$config[prev_tag_close] = </li>;
$config[anchor_class] = class="ajax_fpage";
$this
$content = $this
$fpage = $this
$this
$this
$this
}
From:http://tw.wingwit.com/Article/program/PHP/201311/21102.html