I have a web page where users enter data in a input field. I am trying to pass the entered data to a python script, process it and get back a response. I am running a XAMPP server and modified the httpd.conf file according to this answer.
Frontend:
<script>
            let reviewtext;
            $("#reviewbox").change(function () {
                reviewtext = $('#reviewbox').val();
            });
            $("#submit").click(function (event) {
                let message = {
                    review: reviewtext
                }
                $.ajax({
                    type: "POST",
                    url: "http://127.0.0.1:80/first.py",
                    data: JSON.stringify(message),
                    success: function (response) {
                        alert("Success");
                    },
                    error: function (data) {
                        alert("Fail");
                    },
                });
            });
</script>
Python:
#!C:/Users/xitis/AppData/Local/Programs/Python/Python37-32/python.exe
print("Content-Type: text/html\n")
from flask import request
from flask import jsonify
from flask import Flask
app = Flask(__name__)
@app.route('/first.py', methods=['POST'])
def predict():
    response = {
        'status' : "Success"
    }
    return jsonify(response)
When I run the web page, I dont get any response. The post request is not executing.
Is it even possible to do this ?
Do I have to recreate the entire web site using Flask for this to work ?
 
     
    