Home >Backend Development >PHP Tutorial >Syntax considerations for registerScript in Yii_PHP tutorial
The name of autoLoad cannot be repeated with other scripts!
Do not use comments such as //
Embed PHP variable: '".$params['sdate']."'
The Value in HTML must be double quoted, and the meaning must be changed! ! ! !
Yii::app()->clientScript->registerScript('autoLoad', "
var status= '".$params['type']."';
var sdate = '".$params['sdate']."';
var edate = '".$params['edate']."';
var word = '".Yii::app()->request->getParam('word')."';
$('#ShopInfo_shop_products').val(word);
if(status == 'osub') {
$('#shop_launch_start_time').val(sdate);
$('#shop_launch_end_time').val(edate);
$.fn.yiiGridView.update('report-grids', {
data: $('#form').serialize()
});
}
var currentUser = '".Yii::app()->user->getName()."';
if(currentUser== 'admin')
$('').insertAfter('#ShopInfo_shop_area_id option:last');
");
?>