Reputation: 1019
$.get( "/check", { name: $("#value").val() }, function (data){
if(data){
//do something
}
else if(data){
//do something
});
}
});
how do I access this name variable in the flask route defined as follows
@app.route("/check", methods=["GET"])
def check():
//method body
return jsonify(//some boolean variable)
Upvotes: 1
Views: 392
Reputation: 376
You can access parameters to the request using the 'args' dict in the request object.
from flask import (Flask, request)
@app.route("/check", methods=["GET"])
def check():
return "You wrote" + request.args['name']
Upvotes: 1