我需要能够在注册表单上添加大量地址。我使用了这个example,但它显示错误:
Argument 4 passed to CClientScript::registerScript() must be of the type array, integer given, called in /var/www/yii/protected/views/user/_form.php on line 77 and defined
user / _form.php的一部分
<div id="address">
</div>
<?php echo CHtml::link('Add Child', '#', array('id' => 'loadChildByAjax')); ?>
<?php
Yii::app()->clientScript->registerCoreScript('jquery');
Yii::app()->clientScript->registerScript('loadchild', '
$(document).ready(function(){
$("#loadChildByAjax").click(function(e){
e.preventDefault();
var _url = "' . Yii::app()->controller->createUrl("loadChildByAjax"), '
$.ajax({
method: GET,
url: _url,
dataType: html,
success:function(data){
$("#address").append(data);
}
});
});
});
', CClientScript::POS_END);
?>
有什么问题?
答案 0 :(得分:0)
var _url = "' . Yii::app()->controller->createUrl("loadChildByAjax"), '
应该是
var _url = "' . Yii::app()->controller->createUrl("loadChildByAjax"). '";
我猜想。