Can i use Render Partial in controller to retrun the view in JSON format?

Hi all,

I have an function that calling the controller to generate form and then return as CJSON::encode. The reason i use the CJSON because i have a lot info to update multiple part. So my question is can i generate the form from another php file and then use renderpartial to become return data?

You can have the output of renderPartial returned… its no problem:





$jsonResponse = array();


$jsonResponse['form1'] = $this->renderPartial( 'myForm1', array(), true );

$jsonResponse['form2'] = $this->renderPartial( 'myForm2', array(), true );


echo CJSON::encode( $jsonResponse );




Thanks genn,

i will go to try for it.