summaryrefslogtreecommitdiffstats
path: root/static/functions/questions.js
diff options
context:
space:
mode:
Diffstat (limited to 'static/functions/questions.js')
-rw-r--r--static/functions/questions.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/static/functions/questions.js b/static/functions/questions.js
index 4348602..7729e52 100644
--- a/static/functions/questions.js
+++ b/static/functions/questions.js
@@ -1,4 +1,5 @@
$(document).ready(function() {
+ var open_responses =
$(".answer_link").click(function(e) {
e.preventDefault();
id = this.id;
@@ -18,7 +19,28 @@ $(document).ready(function() {
}).done(function() {
$("#question" + id).remove();
$("#answer" + id).remove();
+ $("#responses_for_" + id).remove();
});
});
+
+ $(".view_responses").click(function(e) {
+ e.preventDefault();
+ id = this.id;
+ if ($("#responses_for_" + id).length == 0) {
+ $.ajax({
+ type : "POST",
+ url : "questions.php?action=ajax_get_answers",
+ dataType : "html",
+ data : {
+ "id" : id,
+ "userid" : $(this).data("gazelle-userid")
+ }
+ }).done(function(response) {
+ $("#question" + id).after(response);
+ });
+ } else {
+ $("#responses_for_" + id).remove();
+ }
+ });
});