diff --git a/app.py b/app.py index 21dd52fa..a57546eb 100644 --- a/app.py +++ b/app.py @@ -64,7 +64,7 @@ def check_code(): return jsonify(output) # Run python in secure system -@app.route('/run_code') +@app.route('/run_code', methods=['POST']) def run_code(): """Run python 3 code :return: JSON object of python 3 output diff --git a/static/js/javascript.js b/static/js/javascript.js index dfc0596d..2b1a07b7 100644 --- a/static/js/javascript.js +++ b/static/js/javascript.js @@ -114,18 +114,18 @@ $(document).ready(function(){ //Actually Run in Python $( "#run" ).click(function() { - $.post('/run_code', { + $.post('/run_code', { text : editor.getValue() }, function(data) { print_result(data); return false; - }); + }, 'json'); function print_result(data){ document.getElementById('output').innerHTML = ''; $("#output").append("
"+data+""); } - }, "json"); + }); var exampleCode = function (id, text) { $(id).click(function (e) { editor.setValue(text);