From 1474cd118f6bdd89a37a44c81900932b0a3791c6 Mon Sep 17 00:00:00 2001 From: Wout Schellaert Date: Fri, 27 Apr 2018 02:13:05 +0200 Subject: [PATCH 1/2] Yeah baby --- content/assets/scripts/message.coffee | 6 ++++++ content/cammie.erb | 11 +++++++++++ 2 files changed, 17 insertions(+) create mode 100644 content/assets/scripts/message.coffee diff --git a/content/assets/scripts/message.coffee b/content/assets/scripts/message.coffee new file mode 100644 index 0000000..8b610ae --- /dev/null +++ b/content/assets/scripts/message.coffee @@ -0,0 +1,6 @@ +$ '.send' + .click -> + $context = $ this + $.ajax "https://kelder.zeus.ugent.be/messages", + type: "POST" + data: $ '.chatbox' diff --git a/content/cammie.erb b/content/cammie.erb index de0dfe2..64ca393 100644 --- a/content/cammie.erb +++ b/content/cammie.erb @@ -4,6 +4,7 @@ title: Cammie --- <% content_for :scripts do %> <%= asset :js, :cammie %> +<%= asset :js, :message %> <% end %>
@@ -66,4 +67,14 @@ title: Cammie +
+ +
From 8f3ab2a0dc8ee4b157a6192f2d13620f22ca6099 Mon Sep 17 00:00:00 2001 From: Wout Schellaert Date: Fri, 27 Apr 2018 04:05:25 +0200 Subject: [PATCH 2/2] Set content type --- content/assets/scripts/message.coffee | 9 +++++++-- content/cammie.erb | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/content/assets/scripts/message.coffee b/content/assets/scripts/message.coffee index 8b610ae..26bff32 100644 --- a/content/assets/scripts/message.coffee +++ b/content/assets/scripts/message.coffee @@ -1,6 +1,11 @@ $ '.send' .click -> $context = $ this - $.ajax "https://kelder.zeus.ugent.be/messages", + $.ajax + # url: "http://localhost:8080/" + url: "https://kelder.zeus.ugent.be/messages/", + contentType: "text/plain", type: "POST" - data: $ '.chatbox' + data: $('.chatbox').val() + success: $('#chat-response').text('Success! :)') + error: $('#chat-response').text('Error !1!') diff --git a/content/cammie.erb b/content/cammie.erb index 64ca393..a32484e 100644 --- a/content/cammie.erb +++ b/content/cammie.erb @@ -68,6 +68,7 @@ title: Cammie
+