$.ajax({
dataType: "json",
url: "blog/posts.json",
cache: false,
success: function (json) {
for (let i = json.length - 1; i >= 0; i--) {
let post = json[i];
if (!$("#blog-post-" + post["id"]).length)
continue;
let nav = "";
if (i > 0)
nav += 'Previous Post';
if (i < json.length - 1)
nav += 'Next Post';
$("#nav-items").append(nav);
break;
}
}
});