I’m want to use json to get data and render it in Virtual List using Framework7
I was able to get the data using javascript
fetch('http://appnavy.tk/wp-json/wp/v2/posts?categories=20')
.then(function (response) {
return response.json();
})
.then(function (data) {
appendData(data);
})
.catch(function (err) {
console.log('error: ' + err);
});
function appendData(data) {
var mainContainer = document.getElementById("myData");
for (var i = 0; i < data.length; i++) {
var div = document.createElement("div");
div.innerHTML = 'Post: ' + data[i].id + ' ' + data[i].title.rendered;
mainContainer.appendChild(div);
}
}
By using the documentations here Virtual List Its very hard to display the data on the list and I’m always get console errors