title: execute python script from javascript
body: <p>I am a newbie to python. I am working on a web app and trying to call a python script from a js script. I am using ajax to call the .py script as follows but I just keep getting the code returned in the response. For simplicity, I have reduced the computation in the python script - even the variable x is not being returned to the js file.</p>
  
  <p>in js function</p>
  
  <pre><code>  return $.ajax({
      type: 'GET',
      url: 'test.py',
  
      success: function(response) {
        console.log(response);
      },
      error: function(response) {
        return console.error(response);
      }
    });
  </code></pre>
  
  <p>test.py</p>
  
  <pre><code>#!/usr/bin/python
  
  print("Hello World")
  
  x = 2
  return x
  </code></pre>
  
  <p>The request succeeds because it moves inside success. response is the python code instead of 2.
  Thanks for your help!</p>