Javascript cakephp分页ajax请求不';行不通

Javascript cakephp分页ajax请求不';行不通,javascript,php,jquery,ajax,cakephp,Javascript,Php,Jquery,Ajax,Cakephp,我非常喜欢cakephp ajax分页。我正在处理一个大项目,我需要一个带有分页的ajax请求的页面。让我解释一下我想要什么。一方面,我想要一个ajax分页(它工作得很好),但另一方面,我需要一个选择选项下拉列表,它构成一个过滤器。每当我在下一个请求中单击此下拉列表时,它就会丢失更改事件。它还创建了一个新的div,其中包含#内容室。请任何人帮助我,因为我已经浪费了很多时间来修理它 查看 <?php $this->Paginator->options(array( 'updat

我非常喜欢cakephp ajax分页。我正在处理一个大项目,我需要一个带有分页的ajax请求的页面。让我解释一下我想要什么。一方面,我想要一个ajax分页(它工作得很好),但另一方面,我需要一个选择选项下拉列表,它构成一个过滤器。每当我在下一个请求中单击此下拉列表时,它就会丢失更改事件。它还创建了一个新的div,其中包含#内容室。请任何人帮助我,因为我已经浪费了很多时间来修理它

查看

<?php 
$this->Paginator->options(array(
'update' => '#content-rooms',
'before' => $this->Js->get('#processing')->effect('fadeIn', array('buffer' => false)),
'complete' => $this->Js->get('#processing')->effect('fadeOut', array('buffer' => false)),
'url' => $this->passedArgs,
'data' => http_build_query($this->request->data),
'method' => 'POST',
'evalScripts' => true
));
$typeRoom = array(
'0' => 'Todos',
'1' => 'A',
'2' => 'B',
);
?>
控制器

public function index() {


        CakeLog::write('debug', __FILE__ . '  ' . __LINE__ . ' message: ' . json_encode($this->request->data));

        $this->Room->recursive = 0;       


        if (isset($this->request->data['type']) && ($this->request->data['type'] != 0)) {
            CakeLog::write('debug', __FILE__ . '  ' . __LINE__ . ' message: type: ' . json_encode($this->request->data['type']));
            $options = array(
                'conditions' => array(
                    'Room.idRoomType' => $this->request->data['type']
                ),
                'limit' => 5,
                'order' => array(
                    'Room.idRoom' => 'desc'
                )
            );
            $this->set('type', $this->request->data['type']);

        } else {
            $options = array(
                'limit' => 5,
                'order' => array(
                    'Room.idRoom' => 'desc'
                )
            );

        }

        CakeLog::write('debug', __FILE__ . '  ' . __LINE__ . ' message: options: ' . json_encode($options));


        $this->layout = ($this->request->is("ajax"))? "ajax": "default";

        $this->Paginator->settings = $options;
        $this->set('rooms', $this->Paginator->paginate());




    }
下面是ajax请求为内容室加载具有重复id的内容时的结果。我想这就是为什么它在下拉列表中丢失了事件。

$(document).ready(function(){
    //send_post();
    $('#typeRoom').change(send_post);
});

function send_post(){
    console.log("send_post");
    //alert($('#state').val());
    $('#option_selected').val($('#typeRoom option:selected').val());    
    console.log("send_post ");
    $.ajax({
        url: '/Rooms/index',
        data: 'type='+$('#option_selected').val(),
        cache: false,
        type: 'POST',
        dataType: 'HTML',
        success: function (data) {
            console.log("on success");
            console.log(data);
            //$('#content').html(data);
            $('#content-rooms').replaceAll();
            $('#content-rooms').html(data);

            //$.getScript("../js/rooms/index.js");
        }
    });
}
public function index() {


        CakeLog::write('debug', __FILE__ . '  ' . __LINE__ . ' message: ' . json_encode($this->request->data));

        $this->Room->recursive = 0;       


        if (isset($this->request->data['type']) && ($this->request->data['type'] != 0)) {
            CakeLog::write('debug', __FILE__ . '  ' . __LINE__ . ' message: type: ' . json_encode($this->request->data['type']));
            $options = array(
                'conditions' => array(
                    'Room.idRoomType' => $this->request->data['type']
                ),
                'limit' => 5,
                'order' => array(
                    'Room.idRoom' => 'desc'
                )
            );
            $this->set('type', $this->request->data['type']);

        } else {
            $options = array(
                'limit' => 5,
                'order' => array(
                    'Room.idRoom' => 'desc'
                )
            );

        }

        CakeLog::write('debug', __FILE__ . '  ' . __LINE__ . ' message: options: ' . json_encode($options));


        $this->layout = ($this->request->is("ajax"))? "ajax": "default";

        $this->Paginator->settings = $options;
        $this->set('rooms', $this->Paginator->paginate());




    }