Ajax is not working properly

Hi there,

I am using Ajax and this is my code.





/*----------------   View page Code  -------------------------*/


echo CHtml::activeTextField($model,'UserName', 

array(

'id'=>'UserName',

'ajax' => array(

'type'=>'POST', //request type

'url'=>CController::createUrl('CrmTicket/dynamiccities'), //url to call

'update'=>'#FullName', //selector to update


))); 

 


 echo CHtml::activeTextField($model,'FullName','',array('id'=>'FullName'));




/*------------------   CrmTicketController code   -----------------------------*/


public function actionDynamiccities()

{

    echo "test";

}






and now what I want is When you enter anything in UserName field it should fill the textfield "Fullname" with value "test" but it is not working. both fields are present in my model and safe attribute also.

can anybody help me

thanks in advance

You must update value of form element. You can try:




echo CHtml::activeTextField($model,'UserName', 

array(

'id'=>'UserName',

'ajax' => array(

'type'=>'POST', //request type

'url'=>CController::createUrl('CrmTicket/dynamiccities'), //url to call

'update'=>'#FullName', //selector to update

'success'=>'js:function(value){jQuery("#FullName").attr(\'value\', value)}',

)));