I need to make the ability to add a lot of addresses on the registration form. I used this example , but it displays an error:
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
Part of 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);
?>
What is wrong?
var _url = "' . Yii::app()->controller->createUrl("loadChildByAjax"), '
Should be
var _url = "' . Yii::app()->controller->createUrl("loadChildByAjax"). '";
i suppose.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.