test-url-params-2 / index2.html
Omnibus's picture
Duplicate from Omnibus/test-url-params
0e6fde2
Raw
History Blame Contribute Delete
455 Bytes
<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>