call a function

hello every one,

I have two drop downs , first is for state and second is for area related to first drop down.

I also want to make a function, which fetches the datafrom the database table (e.g. clients’s state).

so please tell me how to do that ???

means how I have to call the that function on first drop down list ??

please tell me…

My link for Yii1.1x

My link for Yii2.X

Thanks for reply , but in this link, its not given that how to fetch data from database table?

and how to call that in drop down list?

<?php echo $form->dropDownList($model,'city', CHtml::listData(Connecttbl::model()->findAll(array('order' => 'city ASC')), 'id', 'city'),array('onchange'=>'call your ajax function here '))) ; ?>

simply like this , Read full page, multiple ajax call also referred on Yii1.x link