【发布时间】:2011-06-30 15:37:17
【问题描述】:
在我的站点中,我有一个 iframe,其中包含一个 Chtml::ajaxButton。我找到了很多关于这个问题的帖子,但找不到解决方案。
我认为需要强调的重要一点是,此 iframe 并未用于将数据发送到与主机页面不同的域。
view.php
<div style="height: 385px; width: 350px; overflow: hidden">
<?php $url = "displayMessages?league_id=".$model->id; ?>
<iframe src="<?php print $url?>" width="350" height="385">
</iframe>
</div>
LeaguesController.php
public function actionDisplayMessages()
{
if(isset($_GET['league_id'])){
$selectedLeague = $_GET['league_id'];
$league = LigasDeAmigos::model()->findByPk((int)$selectedLeague);
$user = (int)Yii::app()->user->id;
$this->renderPartial('leagueWallMessages', array(
'model'=>$league,
'messages'=>$league->messages,
'user'=>$user,
));
}
}
LeagueWallMessages.php
<?php
echo CHtml::ajaxButton(
"Compartir", CController::createUrl('leagues/insertComment',
array(
'league_id'=>$model->id)),
array(
'success' => "js: function(){ alert('Success!!'); }",
'type' => 'post',
),
array(
'id'=>'idButtonShare',
'style'=>'width:70px;height:40px; align:right;'
)
);
?>
LeagueWallMessages.php 中的此按钮在单击时不会触发任何操作。什么可能导致此问题?
【问题讨论】: