【发布时间】:2014-12-24 11:02:33
【问题描述】:
我正在尝试从我的控制器呈现如下页面
$this->renderPartial("_ReservationDetails",array('rowarray'=>$rowarray,'CalendarID'=>$CalendarID),false,true);
在我的视图文件中,_ReservationDetails我有以下内容
....
...
<td>
<button id="btnPrint" onclick="return PrintReciept();" class="btn btn-small" type="button">Print Reservation</button>
</td>
....
我在 _ReservationDetails 中写了一个脚本,如下所示
<script>
public function PrintReciept()
{
alert("I am here!");
return false;
}
</script>
但是当我单击PrintReservation 按钮时,它会在控制台中引发错误。 PrintReciept() is not defined
为什么会这样?
【问题讨论】:
标签: javascript yii renderpartial