I want to pop out the content inside the modal but it pops up only on data, same data all the time
ContentController.php
public function actionList()
{
$data = array();
$trends=new CDbCriteria;
$trends->order = 'created DESC';
$trends->addCondition("vid=(SELECT MAX(vid) FROM content WHERE id=t.id)")
->addCondition('type_id >= 2')
->addCondition('password = ""')
->addCondition('category_id = 2')
->addCondition('status = 1');
$trends_list = Content::model()->findAll($trends);
$pages->applyLimit($trends);
$this->render('all', array('trends_list'=>$trends_list));
}
all.php
<?php foreach($trends_list as $content): ?>
<?php $this->renderPartial('//content/_recent', array('content' => $content)); ?>
<?php endforeach; ?>
_recent.php
<div id="myModal" class="modal hide">
<div class="modal-header">
<button class="close" data-dismiss="modal">×</button>
<h3><?php echo $content->slug; ?></h3>
</div>
<div class="modal-body">
<div id="modalContent">
<?php echo $content->content; ?>
</div>
</div>
<div class="modal-footer">
<a href="#" class="btn btn-info" data-dismiss="modal" >Close</a>
</div>
</div>
<a href="#myModal" data-toggle="modal" id="<?php echo $content->id; ?>"><?php echo $content->slug;?></a>
<script>
$("a[data-toggle=modal]").click(function()
{
$.ajax({
cache: false,
type: 'POST',
url: "<?php echo $this->createUrl('/' . $content->slug); ?>"+$(this).attr('id'),
data: '',
success: function(data)
{
$('#myModal').show();
$('#modalContent').show().html(data);
}
});
});
</script>