Problem with json in autocomplete

I am trying to use the autocomplete widget to fetch both the id and the name filed from my database through:

public function actionSearch() 


        $res =array();

	if (isset($_GET['term'])) 


            $qtxt ="SELECT name, id FROM user WHERE name LIKE :name";

            $command =Yii::app()->db->createCommand($qtxt);

            $command->bindValue(":name", '%'.$_GET['term'].'%', PDO::PARAM_STR);

            $res =$command->queryColumn();


	echo CJSON::encode($res);      



$this->widget('zii.widgets.jui.CJuiAutoComplete', array(




	// additional javascript options for the autocomplete plugin



                'select'=>'js:function( event, ui ) {                    






The alert function outputs only the name of the selected input, but i want both the id and the name encoded in json. And at receiver side i need properly decoded on the select event to find the id to redirect the user to the correct page. How can i achieve this? Thanks.

Please check this comment.