from flask import Flask from flask_cors import CORS import cgi app = Flask(__name__) CORS(app) form = cgi.FieldStorage() @app.route("/", methods=['POST']) def apicall(): var1 = form.getvalue('var1') if len(var1)>1: return 'received value from JS function' if __name__ == "__main__": app.run()
function callPythonScript() { alert("called_python_script"); $.ajax({ url: "http://127.0.0.1:5000", type: "POST", data:{ var1: window.location.href, }, success: function(response) { console.log(response); }, error: function(xhr) { console.log(xhr); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)