diff options
Diffstat (limited to 'static')
-rw-r--r-- | static/dajaxice/dajaxice.core.js | 4 | ||||
-rw-r--r-- | static/website/js/cloud.js | 19 |
2 files changed, 11 insertions, 12 deletions
diff --git a/static/dajaxice/dajaxice.core.js b/static/dajaxice/dajaxice.core.js index 917ed79..f252e7f 100644 --- a/static/dajaxice/dajaxice.core.js +++ b/static/dajaxice/dajaxice.core.js @@ -13,10 +13,6 @@ var Dajaxice = { return Dajaxice.call('website.node', 'POST', callback_function, argv, custom_settings); }, - execute: function(callback_function, argv, custom_settings){ - return Dajaxice.call('website.execute', 'POST', callback_function, argv, custom_settings); - }, - code: function(callback_function, argv, custom_settings){ return Dajaxice.call('website.code', 'POST', callback_function, argv, custom_settings); }, diff --git a/static/website/js/cloud.js b/static/website/js/cloud.js index 33dd209..e0ee41d 100644 --- a/static/website/js/cloud.js +++ b/static/website/js/cloud.js @@ -110,15 +110,24 @@ $(document).ready(function() { }, {example_id: $(this).val()}); }); + /* Execute the code */ $plotbox_wrapper = $("#plotbox-wrapper"); $plotbox = $("#plotbox"); $(document).on("click", "#execute", function() { $("#execute-inner").html("Executing..."); - Dajaxice.website.execute(function(data) { + var send_data = { + token: $("[name='csrfmiddlewaretoken']").val(), + code: editor.getValue(), + book_id: $("#books").val() || 0, + chapter_id: $("#chapters").val() || 0, + example_id: $("#examples").val() || 0 + }; + $.post("/execute-code", send_data, + function(data){ $("#execute-inner").html("Execute"); result.setValue(data.output); - if(data.plot_path) { + if(data.plot_path){ $plot = $("<img>"); $plot.attr({ src: data.plot_path, @@ -127,12 +136,6 @@ $(document).ready(function() { $plotbox.html($plot); $plotbox_wrapper.lightbox_me({centered: true}); } - }, { - token: $("[name='csrfmiddlewaretoken']").val(), - code: editor.getValue(), - book_id: $("#books").val() || 0, - chapter_id: $("#chapters").val() || 0, - example_id: $("#examples").val() || 0 }); }); |