diff options
Diffstat (limited to 'resources')
-rw-r--r-- | resources/assets/js/chat.js | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/resources/assets/js/chat.js b/resources/assets/js/chat.js index 60563aa..c84f9d6 100644 --- a/resources/assets/js/chat.js +++ b/resources/assets/js/chat.js @@ -14,17 +14,29 @@ // console.log(privateKey); // }); +// $.ajax({ +// type: "POST", +// url: "keys/public/1", +// data: { +// "key": "test_key_2" +// }, +// cache: false, +// success: (results) => { +// console.log(results); +// } +// }); + var socket = io('http://127.0.0.1:8890', { transports: ['websocket'] }); -socket.on('message', function (data) { +socket.on('message', (data) => { data = JSON.parse(data); $("#messages").append("<p>" + data.user + " : " + data.message + "</p>"); }); -$('input.send').click(function (e) { +$('input.send').click((e) => { e.preventDefault(); sendMessage(); }); @@ -36,10 +48,8 @@ function sendMessage() { type: "POST", url: "sendMessage", data: { - "_token": $('meta[name="csrf-token"]').attr('content'), "message": message }, - cache: false, - success: function (results) {} + cache: false }); }
\ No newline at end of file |