summaryrefslogtreecommitdiff
path: root/static/website/js
diff options
context:
space:
mode:
authorJayaram Pai2013-12-01 13:09:49 +0530
committerJayaram Pai2013-12-01 13:09:49 +0530
commit8533d61eb93ecb4c943ec3c3b83dfef87b20a916 (patch)
tree4fa52f3c02fe1f5c50a4d386cc670faeaae6d7e4 /static/website/js
parentaf3e4d8942680a5c08492d2ed179d8e401a8bf57 (diff)
downloadFOSSEE-Forum-8533d61eb93ecb4c943ec3c3b83dfef87b20a916.tar.gz
FOSSEE-Forum-8533d61eb93ecb4c943ec3c3b83dfef87b20a916.tar.bz2
FOSSEE-Forum-8533d61eb93ecb4c943ec3c3b83dfef87b20a916.zip
basic auth and new-question
Diffstat (limited to 'static/website/js')
-rw-r--r--static/website/js/custom.js44
1 files changed, 44 insertions, 0 deletions
diff --git a/static/website/js/custom.js b/static/website/js/custom.js
new file mode 100644
index 0000000..20801f6
--- /dev/null
+++ b/static/website/js/custom.js
@@ -0,0 +1,44 @@
+$(document).ready(function() {
+ $category = $("#id_category");
+ $tutorial = $("#id_tutorial");
+ $minute_range = $("#id_minute_range");
+ $second_range = $("#id_second_range");
+
+ $category.change(function() {
+ var category = $(this).val();
+ $.ajax({
+ url: "/ajax-tutorials/",
+ type: "POST",
+ data: {
+ category: category
+ },
+ success: function(data) {
+ $("#id_tutorial").html(data);
+ $("#id_tutorial").removeAttr("disabled");
+ console.log("response = " + data);
+ }
+ });
+ });
+
+ $tutorial.change(function() {
+ console.log("tut changed");
+ var category = $category.val();
+ var tutorial = $(this).val();
+ $.ajax({
+ url: "/ajax-duration/",
+ type: "POST",
+ data: {
+ category: category,
+ tutorial: tutorial
+ },
+ success: function(data){
+ var $response = $(data);
+ console.log($response.html());
+ $minute_range.html($response.find("#minutes").html())
+ $minute_range.removeAttr("disabled");
+ $second_range.html($response.find("#seconds").html())
+ $second_range.removeAttr("disabled");
+ }
+ });
+ });
+});