Get Return Value From Python Via Javascript Ajax
Solution 1:
So, it looks like the problem here is that you aren't actually serving python code, but rather the file where that code resides. Your server needs another layer sitting between the code and the request that lets it understand how to translate the request into a specific function to run.
Typically, the way python users handle this is by integrating their server code into a web framework like Flask or Pyramid.
If you're also using a webserver for HTML content (which I assume you are, given that the file was reachable at all), you may need to additionally investigate using one more layer, that tells the webserver when to send things to your web framework rather than trying to service them itself. This layer is called WSGI, and most web frameworks will have specific guides with instructions on how to implement WSGI for your particular constellation of technologies.
Post a Comment for "Get Return Value From Python Via Javascript Ajax"