I have a JSON data from FB api reviews, and I want to insert the data from the JSON to an owl carousel div elements. I want each review to be created in a separate div element and that div element to be inside the owl carousel, and to work as carousel.
In the HTML I only have this:
<div id="carousel" class="owl-carousel" style="color: white;">
</div>
Previously I have set up the carousel, now my question is how to take the data from the JSON and insert in the div owl-carousel class but I want the divs that will be inserted inside to take the class owl-item, etc.
Here is the JavaScript:
$(document).ready(function () {
var url = "https://graph.facebook.com/v3.2/...";
$.getJSON(url, function (data) {
var items = [];
$.each(data.data, function (i, obj) {
var text = '<p class="review_text">' + obj.review_text + '</p>'
var date = '<p class="date">' + obj.created_time + '</p>'
}); //Here I get the review text and the created date of the review
//I want to create div element for each review and insert that div in the owl carousel
});
});
This is what I have tried so far: