0

I have a small script that is trying to change or set one of the named parameters for the paginator.

<? echo $this->Html->scriptStart(array('inline'=>false)); ?>
    $('.filter-button').on('click', function() {
        var thisFilter = $(this).data('filter');
        <?php $this->request->params['named']['filter'] = ??? ?>
    });
<?php echo $this->Html->scriptEnd(); ?>

I'm trying to figure out what the best way to set the named paramter filter to the variable thisFilter that was set by javascript (jQuery here)

Jordan
  • 2,393
  • 4
  • 30
  • 60
  • if you need to send a JS value from the frontend to the backenend PHP you will need to post it, receive the post and send it to your model (db save would be one way) so you can handle it in the controller and send it to your view. I'm not sure what kind of data you have, so saving to the DB might not be the best solution. You could also easily use session var and follow the same design pattern – DrewT Aug 25 '15 at 18:40
  • Your best bet (not enough context to answer) is probably to set a cookie via JS, which can take effect on the next HTTP/page request and its pagination. – mario Aug 25 '15 at 18:41

0 Answers0