Create index2.html
Browse files- index2.html +16 -0
index2.html
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<button onclick="returnsUserMessage()">Send</button>
|
| 2 |
+
|
| 3 |
+
<script>
|
| 4 |
+
async function returnsUserMessage() {
|
| 5 |
+
var user_input = document.getElementById("input-chat").value;
|
| 6 |
+
var bot_reponse = await fetch('localhost/response',
|
| 7 |
+
{
|
| 8 |
+
method: 'POST',
|
| 9 |
+
headers: {
|
| 10 |
+
'Content-Type': 'application/json'
|
| 11 |
+
},
|
| 12 |
+
body: JSON.stringify({user_response: user_input})
|
| 13 |
+
});
|
| 14 |
+
// Then you need to present the bot response in your element
|
| 15 |
+
}
|
| 16 |
+
</script>
|