diff options
author | Camil Staps | 2016-09-05 23:57:25 +0200 |
---|---|---|
committer | Camil Staps | 2016-09-05 23:57:25 +0200 |
commit | f0821c85800be8c98c465491c131a65392af050c (patch) | |
tree | 37083d36ca6e72610bfa16c798219f10b77d9988 /public | |
parent | Suggest new verbs (diff) |
Add roots
Diffstat (limited to 'public')
-rw-r--r-- | public/js/moderators.js | 28 |
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; + }); }); |