Java yii:在js中传递参数
我试图通过点击按钮将所选id传递给js 我的代码如下:Java yii:在js中传递参数,java,yii,Java,Yii,我试图通过点击按钮将所选id传递给js 我的代码如下: array( 'class'=>'CButtonColumn', 'template'=>'{email}', 'buttons'=>array ( 'email' => array ( 'label'=>'Send an e-mail to this user', 'click'=>'fun
array(
'class'=>'CButtonColumn',
'template'=>'{email}',
'buttons'=>array
(
'email' => array
(
'label'=>'Send an e-mail to this user',
'click'=>'function($data->userId){
var y=confirm("Are you sure to send mail to this user?");
if(y==true){
window.location="todoList/sendEmail/$data->userId";
}
}',
),
),
),
在这里,我无法在js中获取用户ID
我能在这里做什么?好的,我自己找到了问题的答案。我的工作代码是:
array(
'class'=>'CButtonColumn',
'template'=>'{email}',
'buttons'=>array
( 'email' => array
(
'label'=>'Send an e-mail to this user',
'click'=>'function(){
return confirm("Are you sure to send mail to this user?");
}',
'url'=>'Yii::app()->createUrl("todoList/sendEmail", array("id"=>$data->userId))',
),
),
),好的,我自己找到了问题的答案。我的工作代码是:
array(
'class'=>'CButtonColumn',
'template'=>'{email}',
'buttons'=>array
( 'email' => array
(
'label'=>'Send an e-mail to this user',
'click'=>'function(){
return confirm("Are you sure to send mail to this user?");
}',
'url'=>'Yii::app()->createUrl("todoList/sendEmail", array("id"=>$data->userId))',
),
),
),