【问题标题】:CAkePHP ajax pagination issue with firefoxFirefox 的 CAkePHP ajax 分页问题
【发布时间】:2012-03-24 07:39:52
【问题描述】:

我在 cakePHP 2.0 中使用 Js 分页。我必须使用 cakePHP 分页来管理搜索结果。为此,我在控制器文件中设置了一个 $separator 数组并将其传递到 ctp 文件中

$this->Paginator->options(array('update' => '#mid_cont',
         'url' => array('controller' => 'users', 'action' => 'index', "cond" =>  separator),
            'before' => $this->Js->get("#loading")->effect('fadeIn'),
            'success' => $this->Js->get("#loading")->effect('fadeOut'),
        ));

它在 IE 和 chrome 中运行良好,但在 firefox 中不行。在 firefox 中,我得到 $this->request->params 数组,如下所示:

[plugin] => 
    [controller] => users
    [action] => index
    [named] => Array
        (
           [cond%5Bgender%5D] => 'Male', 
           [cond%5Bage%5D] => '18', 
        )

应该如下所示`在此处输入代码

[plugin] => 
    [controller] => users
    [action] => index
    [named] => Array
        (
           [cond][gender] => 'Male', 
           [cond][age] => '18', 
        )

如果有人知道与此问题相关的任何解决方案或任何建议。请帮我。 提前谢谢..:)

【问题讨论】:

    标签: cakephp pagination


    【解决方案1】:

    编码参数应该没问题:

    // writing
    $this->params['named']['cond'] = base64_encode(json_encode($cond));
    $this->params['named']['cond'] = strtr($this->params['named']['cond'], '+/=', '-_,');
    
    // Reading
    $cond = strtr($this->params['named']['cond'], '-_,', '+/=');
    $cond = json_decode(base64_decode($cond), true);
    

    【讨论】:

    • @user525090 然后您可以验证此答案。谢谢;)
    猜你喜欢
    • 2013-03-26
    • 2016-12-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-02-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多