Add JSON handling with emit and on

This commit is contained in:
Stephan Porada
2019-11-12 12:08:09 +01:00
parent d8b8c9f6e0
commit 55cacf53fc
2 changed files with 14 additions and 17 deletions

View File

@ -81,27 +81,20 @@ socket.on('init_corpus_analysis', function(msg) {
</div>
</div>
</div>
<script>
socket.on('query_results', function(json_results) {
console.log('Results recieved')
console.log(json_results)
let json_results = json_results;
});
</script>
<div class="col s12 m9 l9">
<div class="card">
<div class="card-content">
<span class="card-title">Query Results</span>
<table class="responsive highlight">
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
<tr>
<td>Jill</td>
<td>Smith</td>
<td>50</td>
</tr>
{% for i in range(0,51) %}
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
</tr>
{% for hit in json_results %}
{% endfor %}
</table>
</div>