Load chat data with Node.js and Html-ThrowExceptions

Exception or error:

I need to load the customer’s message data into the chat.
The code below is working correctly, but when I click on the image, I am redirected to the ‘responder.ejs’ view.
I need to load the data without redirecting to another page.
I’m not using socket.io
Very thanks!

enter image description here

//chat.ejs
<!DOCTYPE html>
<html lang="pt-br">
  <head>
    <title>Título da página</title>
    <meta charset="utf-8">
     <link rel="stylesheet" type="text/css"   href="/css/styles.css">
  </head>
  <body>

   <div id="container">
    <aside>
        <header>
            <input type="text" placeholder="search">
        </header>

        <ul>
            <% if (players.length > 0) {%>
                <% players.forEach((player, index) => { %>
            <li>
                <a href="/responder/<%= player.Codigo %>"><img src="/images/logow.png" width="55" height="55" alt=""></a>
                <div>
                    <h2> <%= player.NomeCompleto %></h2>
                    <h3>
                        <span class="status green"></span>
                        <%= player.Celular %> |<a href="/delete/<%= player.Codigo %>"> Deletar </a>|
                    </h3>
                    <h4>
                        <%= player.Mensagem %> ...
                    </h4>
                </div>
            </li>
                <% }) %>
            <% } else { %>

            <% } %>
        </ul>
    </aside>
    <main>
        //CHAT
        // I NEED TO LOAD responder.ejs HERE

    </main>
</div>
  </body>
</html>
How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *