Changes
Title
unchanged
An Easy Solution for Dependent dropDownList Using AJAX
Category
unchanged
Tips
Yii version
unchanged
Tags
unchanged
AJAX, drop down list
Content
changed
Sometimes new Yii guys face problem to manage dependent dropDownList using AJAX.
I am going to discuss
about an easy solution about this issue.
Example code:[...]
'ajax' => array(
'type'=>'POST',
'url'=>CController::createUrl('loadcities'),
'update'=>'#city_name', Yii::app()->createUrl('YourController/loadcities'), //or $this->createUrl('loadcities') if '$this' extends CController
'update'=>'#city_name', //or 'success' => 'function(data){...handle the data in the way you want...}',
'data'=>array('region_id'=>'js:this.value'),
)));[...]