Web/scripts/blog.js

21 lines
766 B
JavaScript
Raw Normal View History

2019-02-23 16:30:23 +01:00
$.ajax({
dataType: "json",
url: "blog/posts.json",
cache: false,
success: function (json) {
let list = $('#blog-list');
2019-06-01 22:26:20 +02:00
list.html("");
2019-02-23 16:30:23 +01:00
for (let i = json.length - 1; i >= 0; i--) {
var obj = json[i];
2019-02-23 16:30:23 +01:00
let p = "";
p += '<div class="card bg-light blog-entry rounded-0">';
p += '<div class="card-body">';
p += '<h2 class="card-title"><a class="blog-button" href="/blog-' + obj.id + '">' + obj.name + '</a></h2>';
p += '<div class="card-text text-muted blog-summary">' + obj.summary + '</div>';
p += '<span class="text-muted project-status">' + obj.date + "</span>";
2019-02-23 16:30:23 +01:00
p += '</div></div>';
list.append(p);
}
}
});