From 1920c3b92b4852c467d35f44fc5913aeea39cf9d Mon Sep 17 00:00:00 2001 From: "John H. Anthony" Date: Sat, 4 Sep 2010 23:39:01 +0200 Subject: enable voting for ViewQuote --- html/quotes.jsp | 15 +-------------- html/vote.js | 10 ++++++++++ src/lq/ViewQuote.java | 1 + 3 files changed, 12 insertions(+), 14 deletions(-) create mode 100644 html/vote.js diff --git a/html/quotes.jsp b/html/quotes.jsp index 0602276..bd2f1f7 100644 --- a/html/quotes.jsp +++ b/html/quotes.jsp @@ -31,20 +31,7 @@ hr {
- - + <% diff --git a/html/vote.js b/html/vote.js new file mode 100644 index 0000000..90811e0 --- /dev/null +++ b/html/vote.js @@ -0,0 +1,10 @@ +function vote(id, value) { + var http = new XMLHttpRequest(); + http.open("GET","/vote?id="+id+"&vote="+value); + http.onreadystatechange=function() { + if(http.readyState==4) { + document.getElementById("v"+id).innerHTML = http.responseText; + } + } + http.send(null); +} diff --git a/src/lq/ViewQuote.java b/src/lq/ViewQuote.java index 411251b..adc6f51 100644 --- a/src/lq/ViewQuote.java +++ b/src/lq/ViewQuote.java @@ -45,6 +45,7 @@ public class ViewQuote extends HttpServlet { "}" + " " + " " + + "" + " "; } -- cgit v1.2.3