diff --git a/app.py b/app.py index 00d21a9c..21dd52fa 100644 --- a/app.py +++ b/app.py @@ -34,7 +34,7 @@ def index(): session["time_now"] = datetime.now() return render_template("index.html") -@app.route('/check_code') +@app.route('/check_code', methods=['POST']) def check_code(): """Run pylint on code and get output :return: JSON object of pylint errors @@ -53,7 +53,7 @@ def check_code(): https://github.com/PyCQA/pylint/blob/master/pylint/lint.py """ #Get textarea text from AJAX call - text = request.args.get('text') + text = request.form['text'] # Session to handle multiple users at one time session["code"] = text diff --git a/static/js/cm-validator-remote.js b/static/js/cm-validator-remote.js index a5ff2d0b..c1c1b680 100644 --- a/static/js/cm-validator-remote.js +++ b/static/js/cm-validator-remote.js @@ -13,7 +13,6 @@ CodeMirror.remoteValidator = function(cm, updateLinting, options) { { var found = []; - console.log(error_list); for(var i in error_list) { var error = error_list[i]; @@ -53,7 +52,7 @@ CodeMirror.remoteValidator = function(cm, updateLinting, options) { }); } } - + updateLinting(cm, found); } diff --git a/static/js/javascript.js b/static/js/javascript.js index de558b57..dfc0596d 100644 --- a/static/js/javascript.js +++ b/static/js/javascript.js @@ -85,7 +85,7 @@ $(document).ready(function(){ } //AJAX call to pylint - $.getJSON('/check_code', { + $.post('/check_code', { text : code }, function(data) { current_text = data; @@ -114,7 +114,7 @@ $(document).ready(function(){ //Actually Run in Python $( "#run" ).click(function() { - $.getJSON('/run_code', { + $.post('/run_code', { text : editor.getValue() }, function(data) { print_result(data); @@ -125,7 +125,7 @@ $(document).ready(function(){ document.getElementById('output').innerHTML = ''; $("#output").append("
"+data+""); } - }); + }, "json"); var exampleCode = function (id, text) { $(id).click(function (e) { editor.setValue(text);