Retrieving data from PHP through JavaScript [closed]

I tried to make simple chat app using the PHP & JavaScript, tried to retrieve chat data from PHP but when I run the code it not passing in JavaScript. It didn’t load the data. Can anyone help?

Javascript

const form = document.querySelector(".typing-area"),
incoming_id = form.querySelector(".incoming_id").value,
inputField = form.querySelector(".form-control"),
sendBtn = form.querySelector("button"),
chatBox = document.querySelector(".direct-chat-messages");

setInterval(() =>{
    let xhr = new XMLHttpRequest();
    xhr.open("POST", "../module/chat/get-chat.php", true);
    xhr.onload = ()=>{
      if(xhr.readyState === XMLHttpRequest.DONE){
          if(xhr.status === 200){
            let data = xhr.response;
            chatBox.innerHTML = data;
            if(!chatBox.classList.contains("active")){
                scrollToBottom();
              }
          }
      }
    }
    xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xhr.send("incoming_id="+incoming_id);
}, 500);

DIV to load the chat data

<div class="direct-chat-messages">
               
</div>