CakePHP scriptBlock在HTML页面中未添加任何JavaScript

问题描述

我只想在HTML <script>标签添加以下提及的JavaScript。

但是下面提到的CakePHP 3.8 scriptBlock函数没有在我的HTML页面上创建任何元素。

echo $this->Html->scriptBlock('
    $.get("/Feed.RSS",function(data) {
        var $XML = $(data);
        var active=" active";
        $XML.find("item").each(function() {
            var $this = $(this),item = {
                    title:       $this.find("title").text(),link:        $this.find("link").text(),description: $this.find("description").text(),pubDate:     $this.find("pubDate").text(),author:      $this.find("author").text()
                };
            $(".carousel-inner").append("<div class=\"carousel-item" + active + "\"><h2>" + item.title + "</h2>" + item.description + "</div>");
            active = "";
        });
    });
    $(".carousel").carousel();',['buffer' => true]
);

请告诉我该怎么办?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)