Skip to content Skip to sidebar Skip to footer

Using Data From Ajax In A Python Script

I'm trying to use a Python script to fill a PostgreSQL table with data received from an Ajax POST. My Ajax command is: function ajaxFct() { $.ajax({ async: true,

Solution 1:

I finally found a way to get the data from the Ajax command within the Python script. First, I had to stringify the data sent by the browser:

data: JSON.stringify(myArray),

Then, I used sys.stdin in the following command in the python script to store the sent data in a local variable:

myDataInPython = json.load(sys.stdin)

Post a Comment for "Using Data From Ajax In A Python Script"