I've done some jQuery functions in a CakePHP project but finally I decided to try the Ajax Helper . Unfortunately I don't get the idea of how to pass a parameter (form field value) to the AJAX function. I did the following:
$obtainProduct = $ajax->remoteFunction(
array(
'url' => array( 'controller' => 'products', 'action' => 'obtain', '{$OrderProductId->id}'),
'update' => 'post' )
);
...
echo $form->input('product_id', array('empty' => true, 'onchange' => "$obtainProduct"));
It calls the function but without retrieving the parameter I need.
I got the idea from the API link docs -api.cakephp.org/class/ajax-helper and I want to get the ID from select box, get it's value and do some lookup in the backend.
So how can I get the ('#OrderProductId option:selected').val or something like this with the helper?