I am new to cakephp. I want to update dropdown corrosponding to a diffent dropdown. Most of the tutorials on the internet are outdated. This is my script file
<script type="text/javascript">
$(document).ready(function($){
$('#city_change').change({
source:'<?php echo $this->Html->url(array("controller" =>"officers","action"=> "locality_ajax")); ?>
});
});
</script>
My action in the controller
public function locality_ajax() {
$city_name = $this->request->data['Post']['city'];
$locality = $this->Locality->find('all', array(
'conditions' => array('city_name' => $city_name),
));
$this->set('locality',$locality);
$this->layout = 'ajax';
}
Any help would be appreciated