Added post fetch script
This commit is contained in:
15
javascript/post.js
Normal file
15
javascript/post.js
Normal file
@ -0,0 +1,15 @@
|
||||
search = window.location.search.replace("?", "");
|
||||
|
||||
fetch("/pages/blog/"+search+"json").then(response => response.json()).then(data => {
|
||||
postTitle = document.getElementById("postTitle");
|
||||
postSubTitle = document.getElementById("postSubTitle");
|
||||
postDate = document.getElementById("postDate");
|
||||
postText = document.getElementById("postText");
|
||||
postTitle.textContent = data.title;
|
||||
postSubTitle.textContent = data.subTitle;
|
||||
postDate.textContent = "Posted: " + data.date;
|
||||
postText.textContent = data.postText;
|
||||
}).catch(error => console.error("Error Fetching Json"));post = JSON.parse(postContent)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user