Looking for a clean solution using JS and views

I have a list and when somebody clicks on an item in the list it will display a div to enter some information. Each div that gets displayed can contain different information. Is it better to load the divs using Yii’s renderPartial or load all of the divs in the same view and use JavaScript to toggle them on or off?


    <li><?php echo CHtml::ajaxLink('FaceBook', array('social/showFaceBook', 'title'=>$itemmodel->title, 'price'=>$itemmodel->price), array('update' => '#facebook-content')); ?></li>

    <li><?php echo CHtml::ajaxLink('Twitter', array('social/showTwitter'), array('update' => '#twitter-content')); ?></li>

<div id="facebook-content"></div>

<div id="twitter-content"></div>


        public function actionShowTwitter() {




	public function actionShowFaceBook($title, $price) {

		$this->renderPartial('_facebook', array('title'=>$title, 'price'=>$price));


_twitter.php (_facebook.php is very similar)






The other option is instead of having different renderPartial files all of the HTML would be in view.php. I would use jquery to hide/show the facebook-content and twitter-content divs when clicking on the <li>Facebook</li> or Twitter link.

Its ok and general solution to load [color=#1C2837][size=2]view.php and show/hide element with js.[/size][/color]

[color=#1C2837][size=2]But after reviewing your current code I prefer current one.[/size][/color]

Using this approach, what would be the best way to hide the content after it has been loaded? The Delete button is going to be responsible for hiding the content using JS, but after it gets loaded I would have to enable its click handler without affecting the other Delete buttons already loaded.