簡體   English   中英

Yii多重相關模型

[英]Yii multiple related model

我需要能夠在注冊表上添加很多地址。 我使用了此示例 ,但顯示錯誤:

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

用戶/_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);
?>

怎么了?

var _url = "' . Yii::app()->controller->createUrl("loadChildByAjax"), '

應該

var _url = "' . Yii::app()->controller->createUrl("loadChildByAjax"). '";

我想。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM