Skip to content

Commit

Permalink
Fix run AJAX call to POST correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanchewy committed Oct 15, 2018
1 parent a11cb93 commit 6724159
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions static/js/javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -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("<pre>"+data+"</pre>");
}
}, "json");
});
var exampleCode = function (id, text) {
$(id).click(function (e) {
editor.setValue(text);
Expand Down

0 comments on commit 6724159

Please sign in to comment.