I want to push some data to the mustache template which I retrieved via webservice. this data need to append under course card blocks. my service function fetching data by course id.
I tried this but didnt worked
$(".card .dashboard-card[data-region=course-content]").closest('[data-course-id]').each(function() {
var id= $(this).data('course-id');
return Repository.getDataById(id)
.then(function(data) {
return Templates.render('block_my_blockname/templatename', courses)
}).then(function(html, js) {
return Templates.replaceNodeContents(data, html, js);
}).catch(Notification.exception);
});