Rework button handler

This commit is contained in:
Bálint Bokros 2017-11-27 19:00:02 +01:00
parent f6a8bf6239
commit 982f72b4ba
1 changed files with 9 additions and 6 deletions

View File

@ -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) {