How To Create Dependent Dropdownlists

i have studied a lot but can’t solve this problem i have followed this wiki but its not working for me here is my code can any one find where i am doing mistake plzz

form




<div class="row">

<tr>

<th>

<?php echo $form->labelEx($model,'Merchant or Brand',array('style'=>'display:inline','margin-left'=>"20px")); ?>

</th>

<td>

<?php echo CHtml::activeDropDownList($model,'merchant',Merchant::model()->Merchant,array(

'ajax' => array(

'type'=>'POST',

'url'=>Yii::app()->createUrl('search/dynamiccities'),

'update'=>'#'.CHtml::activeId($model,'citylist'),

)));

?>

</td>

</tr>

<tr id="merchantcity">

	<td></td>

<td>

<?php echo CHtml::activeDropDownList($model,'citylist', array()); ?>

</td>

</tr>

</div>



controller action




public function actiondynamiccities(){

$data=Merchant::model()->findAll(true);

$data=CHtml::listData($data,'id','name');

foreach($data as $value=>$name)

{

	echo CHtml::tag('option',

	   array('value'=>$value),CHtml::encode($name),true);

}

}



is there any error in your browser console if you are getting a js error post that too that might help to track the problem one cannot figure out by looking at the code

i don’t knw how but now its working i was working on it from the past 4 hours, any way thanks alot for your response :)