update two divs using ajax each of the divs in turn has renderPartial

Hi,

I am trying to update two divs usings ajax link.

here is my ajaxlink code


array('Favourites/account_favourite/'.$Member_ID), // the URL for the AJAX request. If empty, it is assumed to be the current URL.


array(

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

'dataType'=>'json',

'success'=>'function(data) {

$("#submenu").html(data.submenu);

$("#detail_data").html(data.detail);


}'),array('class'=>'textcontent'));

and this is my function code…


public function actionAccount_favourite($id)

	{			

$submenu='sub menu table';


$detail = 'details';


// return data (JSON formatted)

echo CJSON::encode(array(

'submenu'=>$submenu

,

'detail'=>$detail

));


//

	}

which works properly and i get the result in my two divs… but i want to use renderPartial to update the divs which gives prob…

this is the function i wrote :


public function actionAccount_favourite($id)

	{


// return data (JSON formatted)

echo CJSON::encode(array(

'submenu'=>$this->renderPartial('view')

,

'detail'=>$this->renderPartial('detail'),


));

	}

can anyone tel me where i am going wrong?

You actually "render" the view when you need to return it.

So it’ll be:




public function actionAccount_favourite($id)

        {


// return data (JSON formatted)

echo CJSON::encode(array(

'submenu'=>$this->renderPartial('view',array(),true)

,

'detail'=>$this->renderPartial('detail',array(),true),


));

        }