aboutsummaryrefslogtreecommitdiffhomepage
path: root/resources/assets
diff options
context:
space:
mode:
authorMarvin Borner2018-07-07 13:14:04 +0200
committerMarvin Borner2018-07-07 13:14:04 +0200
commit3a8cdacbd4522c47766e6679454a7b7cd91bf0bd (patch)
tree2a60bccb52003c887887d4fa6310f2f798413f7e /resources/assets
parent0a11d1058cb96801dce64d035fd1e269976793a8 (diff)
Added ajax test for public key insertment
Diffstat (limited to 'resources/assets')
-rw-r--r--resources/assets/js/chat.js20
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