• Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

JavaScript Fetch request to render html

gunaratna

New Coder
I am using a fetch request to trigger a 'view' function in bakend.

However, response of 'fetch' is not rendering correct html. Can someone help,please?

fetch request:
document.getElementById("postCreaterProfile").style.display = 'block';
    document.getElementById('userName').style.display = 'none';
    document.getElementById('PostCreaterName').style.display = 'block';
    document.getElementById('PostCreaterName').innerText = postCreater;
    post_creater = postCreater

    fetch('/posts/' + post_creater)
    .then(response => response.status)
    .then(posts => {
      console.log(posts);
      
  })
  }
 

Top