+ 3

How can I pass a variable from some.js to some.py?

Hello! I have a problem: I need to pass the value of a variable from js script to py script. I am creating a website. It has 2 input fields (description and mail) and I need to send data from both fields to my mail. There is already a Python script for sending the message, but I need to somehow pass variables with data for the message from js to py for sending. Both scripts are in the same folder. How can i do this? I tried in various ways from the internet, but none worked. Thanks in advance!

20th Jul 2020, 1:09 PM
Professional Anonyme
Professional Anonyme - avatar
2 Respostas
+ 1
Im not a js programmer, but i work with json data in python and its just as easy as making the json data a dictionary. Its java script object notation so Id look up how to for that data. Then you should be able to set up a socket and give your js code the json data to pass as a response. Make a request with your python script and have conditions set so a certain keyword or two will trigger the wanted response.
20th Jul 2020, 1:37 PM
Slick
Slick - avatar
0
is there any way to send the data from js as json to your .py script?
20th Jul 2020, 1:21 PM
Slick
Slick - avatar