From 3c757bc4cab49892792af679a0e1335bc0587891 Mon Sep 17 00:00:00 2001 From: Zambom Date: Thu, 20 Oct 2016 07:51:15 -0300 Subject: [PATCH] Adding js function to subscribe [Issues: #192 and #195 ] --- courses/static/js/course.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+), 0 deletions(-) diff --git a/courses/static/js/course.js b/courses/static/js/course.js index e69de29..47d2110 100644 --- a/courses/static/js/course.js +++ b/courses/static/js/course.js @@ -0,0 +1,21 @@ +/* +* +* Function to subscribe (works for courses and subjects) +* +*/ +function subscribe(elem, url, confirm_message) { + alertify.confirm(confirm_message, function(){ + $.ajax({ + dataType: "json", + url: url, + success: function (data) { + if (data.status == "ok") { + elem.disabled(true); + alertify.success(data.message); + } else { + alertify.error(data.message); + } + } + }); + }); +} \ No newline at end of file -- libgit2 0.21.2