summaryrefslogtreecommitdiff
path: root/website
diff options
context:
space:
mode:
Diffstat (limited to 'website')
-rw-r--r--website/ajax.py1
-rw-r--r--website/js/cloud.js19
2 files changed, 11 insertions, 9 deletions
diff --git a/website/ajax.py b/website/ajax.py
index 6d8d074..e69a07f 100644
--- a/website/ajax.py
+++ b/website/ajax.py
@@ -10,7 +10,6 @@ from django.core.context_processors import csrf
from django.views.decorators.csrf import csrf_exempt, csrf_protect
from django.db.models import Q
-from website.helpers import scilab_run
from website.models import TextbookCompanionPreference,\
TextbookCompanionProposal, TextbookCompanionChapter,\
TextbookCompanionExample, TextbookCompanionExampleFiles,\
diff --git a/website/js/cloud.js b/website/js/cloud.js
index 33dd209..e0ee41d 100644
--- a/website/js/cloud.js
+++ b/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
});
});