How can I execute a local python file in a locally run javascript file?

281 Views Asked by At

I'm working a robotics project for which I already have a ton of python code. The robot sends data to my web page, which is running locally. When the data is recieved I need my javascript to run my python code, which will then process it and send instructions back to the robot directly. Is calling the local file possible? If not, where's the best place to upload it to make it available?

Thanks

1

There are 1 best solutions below

0
On

$.ajax({

type: "POST",

url: "~/mycode.py",

data: { param: text}

}).done(function( o ) {

// do what you want it to do

});

Hope this helps