aboutsummaryrefslogtreecommitdiff
path: root/public/js/moderators.js
diff options
context:
space:
mode:
Diffstat (limited to 'public/js/moderators.js')
-rw-r--r--public/js/moderators.js28
1 files changed, 26 insertions, 2 deletions
diff --git a/public/js/moderators.js b/public/js/moderators.js
index 1a61075..10dd2a0 100644
--- a/public/js/moderators.js
+++ b/public/js/moderators.js
@@ -63,7 +63,6 @@ $(document).ready(function(){
});
$('form#suggest').submit(function(){
- var data = $(this).serialize();
var form = $(this);
form.clearAlerts();
@@ -71,7 +70,7 @@ $(document).ready(function(){
$.ajax({
url: app_url + 'verb/suggest',
method: 'post',
- data: data,
+ data: form.serialize(),
error: function(jqxhr, stat, error) {
form.addAlert('danger', stat);
},
@@ -91,4 +90,29 @@ $(document).ready(function(){
return false;
});
+
+ $('form#add-root').submit(function(){
+ var form = $(this);
+
+ form.clearAlerts();
+
+ $.ajax({
+ url: app_url + 'root/create',
+ method: 'post',
+ data: form.serialize(),
+ error: function(jqxhr, stat, error) {
+ form.addAlert('danger', stat);
+ },
+ success: function(data) {
+ if (!data.success) {
+ form.addAlert('danger', data.message);
+ return;
+ }
+
+ window.location = window.location;
+ }
+ });
+
+ return false;
+ });
});