I am on a dreamhost server and have some HTML that calls some javascript when a button is pressed. I am trying to call a python script when this button is tapped.
First off, to my knowledge as I am on a shared host I cannot use AJAX as it is not supported, so I need to do this without AJAX. Right now I am trying to do a XMLHttpRequest
which is working.
I also realize doing an XMLHttpRequest
is not the best way since the files are both on the server there must be a way to just call the file directly?
So if someone call tell me how to call it directly or help me fix this error in the browser console that would be great. Thanks for the help
EDIT
I have an HTML file when a user taps a button on this file it calls some javascript that is in the HTML file. This javascript currently makes a POST Request, to a python script that is on the same server and the HTML file.
What I want instead of making a post request to the python file that is on the server, I want to just directly call the python file, from the javascript that runs, when the button the clicked in the HTML file.
Both the HTML file which contains the javascript and the python file are on the same server. And I don't want the python to run in the browser, I want it to run in the background on the server.
How can I use the Javascript to call this python file?