Spaces:
Sleeping
Sleeping
Commit
ยท
bf61373
1
Parent(s):
b730065
Update templates/home.html
Browse files- templates/home.html +21 -3
templates/home.html
CHANGED
@@ -15,10 +15,28 @@
|
|
15 |
<form action="{{url_for('classify')}}" method="POST">
|
16 |
<textarea name="comment" required="true" rows="1" cols="40"></textarea>
|
17 |
<br>
|
18 |
-
<input type="submit" value="ุตูููู" class="button-89">
|
19 |
<br>
|
20 |
-
|
21 |
-
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
</form>
|
24 |
</div>
|
|
|
15 |
<form action="{{url_for('classify')}}" method="POST">
|
16 |
<textarea name="comment" required="true" rows="1" cols="40"></textarea>
|
17 |
<br>
|
18 |
+
<input id="text" type="submit" value="ุตูููู" class="button-89">
|
19 |
<br>
|
20 |
+
<div name = "output" id="output" style="visibility: hidden;">
|
21 |
+
<p class="output-statement">{{output}}</p>
|
22 |
+
</div>
|
23 |
+
<script>
|
24 |
+
var text = document.getElementById("text").value
|
25 |
+
document.getElementById("output").style="visibility: visible";
|
26 |
+
$('form').on('submit', function(event) {
|
27 |
+
$.ajax({
|
28 |
+
type: 'POST',
|
29 |
+
url: "{{ url_for( '/classify' ) }}",
|
30 |
+
data: JSON.stringify({'input':text}),
|
31 |
+
contentType: "application/json",
|
32 |
+
success:function(response){
|
33 |
+
success: function(response) {
|
34 |
+
document.write(response);
|
35 |
+
document.getElementById("output").style="visibility: visible";
|
36 |
+
},
|
37 |
+
}
|
38 |
+
})
|
39 |
+
</script>
|
40 |
|
41 |
</form>
|
42 |
</div>
|