File size: 454 Bytes
2eee758
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<button onclick="returnsUserMessage()">Send</button>

<script>
async function returnsUserMessage() {
  var user_input = document.getElementById("input-chat").value;
  var bot_reponse = await fetch('localhost/response',
    {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({user_response: user_input})
    });
  // Then you need to present the bot response in your element
}
</script>