I am very new to Flask and before i proceed further, is it possible to perform a "post" from jquery to python function using flask and json? I'm not familiar with json too and therefore all those codes seem very complicated to me.
For example:
from flask import Flask, jsonify, render_template, request
app = Flask(__name__)
@app.route('/_add_numbers')
how do I determine what to substitute /_add_numbers? I can't really find a good site to show me a simple tutorial or steps to do post with flask.
This is my current jQuery function:
$('#left_button').click(function(){
$.post("cameraservo2.py", {direction:"left"}).done(function (reply) {
$('#camerapos').empty().append(reply);
alert("left button clicked");});
});
Can I do this WITHOUT using the json??
HTTP POSTis used to transmit data to the server. Are you trying to get data from the server and display it or are you trying to push data to the server for processing?$.post('cameraservo2.py')runs the python code incameraservo2.py. That does absolutely not happen.