Commit 3c757bc4cab49892792af679a0e1335bc0587891
1 parent
0a19eb3e
Exists in
master
and in
5 other branches
Adding js function to subscribe [Issues: #192 and #195 ]
Showing
1 changed file
with
21 additions
and
0 deletions
Show diff stats
courses/static/js/course.js
... | ... | @@ -0,0 +1,21 @@ |
1 | +/* | |
2 | +* | |
3 | +* Function to subscribe (works for courses and subjects) | |
4 | +* | |
5 | +*/ | |
6 | +function subscribe(elem, url, confirm_message) { | |
7 | + alertify.confirm(confirm_message, function(){ | |
8 | + $.ajax({ | |
9 | + dataType: "json", | |
10 | + url: url, | |
11 | + success: function (data) { | |
12 | + if (data.status == "ok") { | |
13 | + elem.disabled(true); | |
14 | + alertify.success(data.message); | |
15 | + } else { | |
16 | + alertify.error(data.message); | |
17 | + } | |
18 | + } | |
19 | + }); | |
20 | + }); | |
21 | +} | |
0 | 22 | \ No newline at end of file | ... | ... |