Get Blog Content

Hi,

i’m using wordpress API to get title and image to render on index page. the code i used like:

  function getPost(category) { 
     app.request.json("https://website.com/wp-json/wp/v2/posts", function(data2) {
    console.log(data2);
    var str2 = "";
      data2.forEach(element => {
        if (element && 
            element.better_featured_image && 
            element.better_featured_image.media_details && 
            element.better_featured_image.media_details.sizes && 
            element.better_featured_image.media_details.sizes.thumbnail && 
            element.better_featured_image.media_details.sizes.thumbnail.source_url) 
        { 
          img = element.better_featured_image.media_details.sizes.thumbnail.source_url;
        }
                  str2 += '<a href="/berita/" "li class="item-content ripple">'+
                  '<div class="item-media"><img src="'+img+'" width="44"></div>'+
                  '<div class="item-inner">'+
                    '<div class="item-title-row">'+
                      '<div class="item-title">' + element.title.rendered +'</div>'+
                    '</div>'+
                    '<div class="item-subtitle"><div class="chip">'+
                      '<div class="chip-label">'+category[element.categories[0]]+'</div>'+
                      '</div>'+
                    '</div>'+
                  '</div>'+
                  '</a>'+
                '</li>';
      }); 
$('#datapost').html(str2);
 });
}

Result:

It’s works, but my question is
How to render content ’ + content.rendered +’ On my ./pages/news.html ?

anyone can help?
Stuck to get blog post detail

You can use router component page for that blog post where you need to request data and render to page http://framework7.io/docs/router-component.html