I have managed to get the ajax function in cakephp which calls when a dropdown is clicked to populate another dropdown. The one area I cannot get is passing in the id value of the first dropdown so I can do a find.
I wish to pass in the company id so I can get the related employees.
Thanks.
View:
<?php
$this->Js->get('#MonthlyReturnCompanyId')->event('change',
$this->Js->request(
array(
'controller'=>'MonthlyReturns',
'action'=>'getemployees',
),
array(
'update'=>'#test',
'async' => true,
'method' => 'post',
'dataExpression'=>true,
'data'=> $this->Js->serializeForm(array(
'isForm' => false,
'inline' => true
))
)
)
);
?>
echo $this->Form->input('company_id' , array('empty' => true));