Yii和YiBooster小部件模式确认url
使用yiibooster模式小部件,如果用户单击ok确认,我希望它转到另一个urlYii和YiBooster小部件模式确认url,yii,Yii,使用yiibooster模式小部件,如果用户单击ok确认,我希望它转到另一个url $this->widget('bootstrap.widgets.TbButton', array( 'label'=>'Restart Game', 'type'=>'warning', 'htmlOptions'=>array( 'onclick'=>'js:bootbox.confirm("Are you sure?",
$this->widget('bootstrap.widgets.TbButton', array(
'label'=>'Restart Game',
'type'=>'warning',
'htmlOptions'=>array(
'onclick'=>'js:bootbox.confirm("Are you sure?",
function(confirmed){console.log("Confirmed: "+confirmed);})'
),
));
//this is the url i want it to go to when ok confirmed is clicking
'url' =>array('site/restart?gameId='.$gameRecord->id)
如果是这样的话:
'url'=>array('site/restart',array('id'=>$gameRecord->id))
假设您在配置中有或需要规则?请尝试以下代码:
$url = Yii::app()->createAbsoluteUrl('site/restart', array('id'=>$gameRecord->id));
$this->widget('bootstrap.widgets.TbButton', array(
'label'=>'Restart Game',
'type'=>'warning',
'htmlOptions'=>array(
'onclick'=>'js:bootbox.confirm("Are you sure?",
function(confirmed){
if(confirmed) {
window.location = "'.$url.'";
}
})'
),
));