Return array values for JEditable select

Hello,

I’m trying to return an array of valuers for a select field using the JEditable plugin. I’m having an issue pulling the array for the select field. I think my issue is that I can’t figure out the setup in Yii:

In my model


	public function getProjectOptions()

	{

		$user=Users::model()->findByAttributes(array('username'=>Yii::app()->user->id));

		$accountnumber = $user->accountnumber;

		$projectsArray = CHtml::listData(Projects::model()->findAllByAttributes(array('accountnumber'=> $accountnumber)), 'internalid', 'projectname');

		return $projectsArray;

	}

In my controller (I setup the permission)


	public function actionGetselects()

	{

		$selectTest=TimeEntries::model()->getProjectOptions();

		$dataProvider=new CArrayDataProvider($selectTest);

		$arraytest=$dataProvider->getData();

		echo $arraytest;

	}



In the JEditable plugin


Yii::app()->clientScript->registerScript("editable", "                    

     

      $('.dle_select')editable('http://www.example.com/save.php', { 

     loadurl : 'http://localhost/yalla/index.php?r=timeentries/getselects',

     type   : 'select',

     submit : 'OK'

    });

     ", CClientScript::POS_READY);



Any suggestions? I think I just need to figure out how to pass an array from my controller to the javascript function in the view.

As a second test I ran the following code to see what would be returned:


Yii::app()->clientScript->registerScript("test", "                    

      $('.dle_select').hover(function(){

      $.ajax({

      url:'http://localhost/yalla/index.php?r=timeentries/getselects',

      success:function(data){

      alert(data);

      },

      error:function(data){

      alert('Better luck next time');

      }

      });

    });

     ", CClientScript::POS_READY);

All that gets returned in the popup is the string "Array".

Never mind I got it.




	public function actionGetselects()

	{

		$selectTest=TimeEntries::model()->getProjectOptions();

		foreach($selectTest as $key => $value){

		$array[$key]=$value;

		}

		echo json_encode($array);

	}