diff --git a/src/app/static/ws_listener.js b/src/app/static/ws_listener.js index 89cd1eb..3909d81 100644 --- a/src/app/static/ws_listener.js +++ b/src/app/static/ws_listener.js @@ -2,13 +2,16 @@ let ws = new WebSocket('ws://' + document.location.host + '/ws'); $('#container').on('click', '.anchor', ( function (event) { + let anchorName = $(this).attr('id').replace('_event', ''); + let data = JSON.stringify({ + 'anchor': anchorName, + 'data': $('#' + anchorName).text() + }); + console.log('Sending: '); + console.log(data); + ws.send(data); +})); let anchorName = $(this).attr('id').replace('_event', ''); - let data = JSON.stringify({ - 'anchor': anchorName, - 'data': $('#' + anchorName).text() - }); - console.log("Sending: " + data); - ws.send(data); })); ws.onmessage = function (messageEvent) {