window.addEventListener('DOMContentLoaded', function() {
      fetch('get_comments.php')
        .then(response => response.json())
        .then(comments => {
          comments.forEach(comment => {
            const li = document.createElement('li');
            li.classList.add('comment-item');
            li.dataset.id = comment.id;
  
            const p = document.createElement('p');
            p.textContent = comment.comment;
            li.appendChild(p);
  
            const delBtn = document.createElement('button');
            delBtn.textContent = '削除';
            delBtn.classList.add('delete-comment');
            delBtn.addEventListener('click', function() {
              fetch('delete_comment.php', {
                method: 'POST',
                headers: {
                  'Content-Type': 'application/json'