I am very new to Python / Flask / Javascript, and would appreciate it if someone could help me with this.
I am trying to pass a string value from Javascript back to Python but it does not seem to work. My code is as follows:
Javascript (partial code):
var bounds = '8.3,9,34.3,15.9';
$.post("/receiver", {
bbox_bounds: bounds
});
In Python:
from flask import Flask, request
#Create the Flask app
app = Flask(__name__)
@app.route('/receiver', methods = ['POST'])
def receiver():
bbounds = request.form('bbox_bounds')
print "Bounds: " + bbounds
return bbounds
if __name__ == '__main__':
app.run(port=5000)
Sorry, the above is bad, but I am really a beginner. Thank you.