I just want to add below mention JavaScript within an HTML <script>
Tag.
But below mentioned CakePHP 3.8 scriptBlock
function is not creating any element on my HTML page.
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]
);
Please tell me what should I do?