From 3a8cdacbd4522c47766e6679454a7b7cd91bf0bd Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sat, 7 Jul 2018 13:14:04 +0200 Subject: Added ajax test for public key insertment --- resources/assets/js/chat.js | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'resources') 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("
" + data.user + " : " + data.message + "
"); }); -$('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 -- cgit v1.2.3