summaryrefslogtreecommitdiff
path: root/static/website/js/cloud.js
diff options
context:
space:
mode:
authordivakar18002017-07-04 20:01:02 +0530
committerdivakar18002017-07-04 20:01:02 +0530
commit6ce5c567e8a4b4e93c8687f8e0447a28e8f32157 (patch)
treede1c6fde28d29a784a21dc6e59540361447a4147 /static/website/js/cloud.js
parente9e998e8061b8a8a2356a090c486af8c5aa4de6a (diff)
downloadscilab-on-cloud-6ce5c567e8a4b4e93c8687f8e0447a28e8f32157.tar.gz
scilab-on-cloud-6ce5c567e8a4b4e93c8687f8e0447a28e8f32157.tar.bz2
scilab-on-cloud-6ce5c567e8a4b4e93c8687f8e0447a28e8f32157.zip
optimisation of code execution.
Diffstat (limited to 'static/website/js/cloud.js')
-rw-r--r--static/website/js/cloud.js19
1 files changed, 11 insertions, 8 deletions
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
});
});