I'm submitting a string and want to retrieve it back from the server. The issue seems to be that Flask's Request module isn't picking up the URL arguments - i.e. I get "HELLO" instead of the string variable.
As an aside, console.log(status) is undefined, and I'm not sure if that's related.
Here is the HTML...
<html>
<script type="text/javascript" src= "http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.js"></script>
<form>
<input id = "entered_string" name = "string">
<input type = "button" value = "submit" id = "submit_button">
</form>
<div id = "result">?</div>
<script>
$("#submit_button").bind("click", function(data, status){
var string = $("#entered_string").val()
console.log(string)
console.log(data)
console.log(status)
$.get('/upper_case', function(string){
console.log(string)
$("#result").text(string.result)
})
})
</script>
</html>
and the server code...
@app.route('/', methods = ['GET', 'POST'])
def case_converter():
return render_template("new.html")
@app.route('/upper_case')
def upper():
print request.args
string = request.args.get('string', "hello", type=str)
print string
return jsonify(result = string)