Pass dynamic value in URL with CakePHP

Posted by Renato Dinhani Conceição on Stack Overflow See other posts from Stack Overflow or by Renato Dinhani Conceição
Published on 2012-12-14T12:34:20Z Indexed on 2012/12/14 17:03 UTC
Read the original article Hit count: 184

Filed under:
|
|

I have the following method that performs an Ajax request passing some dynamic value obtained from a select input.

It works fine, but the dynamic value is passed as parameter in the URL, something like states/listCities/?big_string_of_serialized_parameter .

$this->Js->event(
    'change', 
    $this->Js->request(
        array( #url
            'controller' => 'states', 
            'action' => 'listCities'),
        array( # ajax options that generates the serialized parameter
           'update' => '#DealerCityId', 
           'data' => '$("#DealerStateId").serialize()',
           'dataExpression' => true
        )
    )
);

I'm trying to do this in a more friendly URL way, something like states/listCities/2.

It's possible in CakePHP to generate a friendly URL like this with dynamic value from a input or is only possible passing the dynamic values as parameters?

© Stack Overflow or respective owner

Related posts about php

Related posts about AJAX