* views/test.php echo CHtml::ajaxLink( 'Test request', array('ajax/reqTest02'), array( 'update'=>'#req_res' ) ); ?> <div id="req_res">...</div> * controllers/Controller.php public function actionReqTest02() { $date = date('H:i:s'); $this->renderPartial('actionReqTest02', array('date'=>$date)); Yii::app()->end(); } * views/actionReqTest02.php <input id="btnAlertDate" type="button" value="Alert date" /> <script type="text/javascript"> $('#btnAlertDate').click(function(){ alert('<?php echo $date; ?>'); }); </script>
Yii Справочник v0.05 © 2007-2024 Igor Salnikov aka SunDoctor