diguoelang 2014-09-18 18:40:03 3786次浏览 2条回复 0 0 0

我在控制器中使用clientscript注册JS文件 Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl."/js/loading.js");

但是无法注册上,页面根本没有加载这个JS,我跟代码发现在controller中

public function recordCachingAction($context,$method,$params)
{
    if($this->_cachingStack) // record only when there is an active output cache
    {
        foreach($this->_cachingStack as $cache)
            $cache->recordAction($context,$method,$params);
    }
}

这个方法中的_cachingStack为空。。。 这跟缓存有关。。。。 我只想注册JS到前台。。。。。。。。。求解决~~~~

  • 回复于 2014-09-19 10:41 举报

    没看到你clientscript注册js的代码。

  • 回复于 2014-09-19 18:05 举报

    Yii2.0还是这样注册么?不是控制器与视图分离了么?

    url: 'http://www.yiichina.com/follow?id=28519',
    dataType: 'json',
    success: function(data) {
    	if(data.action == 'create')
    	{
    	}
    	else
    	{
    		$.ajax({
    			url: 'http://www.yiichina.com/follow?id=28519',
        		});
    	}
        },
    

    });

您需要登录后才可以回复。登录 | 立即注册