23 lines
No EOL
872 B
JavaScript
23 lines
No EOL
872 B
JavaScript
$.ajax({
|
|
dataType: "json",
|
|
url: "blog/posts.json",
|
|
cache: false,
|
|
success: function (json) {
|
|
let list = $('#blog-list');
|
|
list.html("");
|
|
for (let i = json.length - 1; i >= 0; i--) {
|
|
var obj = json[i];
|
|
let id = obj["id"];
|
|
|
|
let p = "";
|
|
p += '<a class="blog-anchor" id="blog-' + id + '"></a>';
|
|
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-' + 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>";
|
|
p += '</div></div>';
|
|
list.append(p);
|
|
}
|
|
}
|
|
}); |