1

早上好,

我使用 cakephp2.3 通过 ajax 创建了一个分页,它工作正常。问题是 url 中的页码没有更新。

他是这样的:

  / Localhost/cakephp-2.3.4/Anuncios/inicio /

并希望出现页面/类型,或多或少,如果我点击第7页,url必须是:

  / Localhost/cakephp-2.3.4/Anuncios/inicio/page: 7

有谁知道我该怎么做?我搜索但没有找到任何可以帮助我的材料。

4

1 回答 1

0

使用 history.pushState

设置您的 JS 链接以进行排序和分页,例如:

if (history && history.pushState) {
        $('.yourTable th a, .paginationBar .controles a').on('click', function () {
            $.getScript(this.href);
            history.pushState(null, document.title, this.href);
            return false;
        })
        $(window).bind("popstate", function () {
            $.getScript(location.href);
        });
    } // history
于 2013-11-01T16:12:46.007 回答