title: Run python code inside <script> tag of HTML file
body: <p><code>(server.js)</code> I have following code to run my server - </p>
  
  <pre><code>var http = require('http');
  var fs = require('fs');
  var path = require('path');
  
  http.createServer(function (request, response) {
      console.log('request starting...');
  
      var filePath = '.' + request.url;
      if (filePath == './')
          filePath = './public/index.html';
  
      var extname = path.extname(filePath);
      var contentType = 'text/html';
      switch (extname) {
          case '.js':
              contentType = 'text/javascript';
              break;
          case '.json':
              contentType = 'application/json';
              break;
      }
  
      fs.readFile(filePath, function(error, content) {
          if (error) {
              if(error.code == 'ENOENT'){
                  fs.readFile('./404.html', function(error, content) {
                      response.writeHead(200, { 'Content-Type': contentType });
                      response.end(content, 'utf-8');
                  });
              }
              else {
                  response.writeHead(500);
                  response.end('500 Internal Server error: '+error.code+' ..\n');
                  response.end(); 
              }
          }
          else {
              response.writeHead(200, { 'Content-Type': contentType });
              response.end(content, 'utf-8');
          }
      });
  
  }).listen(8000);
  console.log('Server running at http://localhost:8000/');
  </code></pre>
  
  <p><code>(index.html)</code> And my index.html file inside public directory is following - </p>
  
  <pre><code>&lt;!doctype html&gt;
  
  &lt;html&gt;
  &lt;head&gt;
    &lt;meta charset="utf-8"&gt;
      &lt;script type="text/javascript" src="./jquery.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="./algebra.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="./math.js"&gt;&lt;/script&gt; 
  
      &lt;script&gt;
          //Some more code ...
          function runPythonCode(x, y){
              //process python file and get result
          }
          runPythonCode(2, 3);
      &lt;/script&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>In above code inside <code>runPythonCode</code> function I want to pass variable <code>x</code> and <code>y</code> to my python code and do some processing with <code>x</code> and <code>y</code> and want the value return back to javascript.</p>
  
  <p>I was simply tried like this inside the script tag in index.html just to check if python script is running or not - </p>
  
  <pre><code>text = "hello"
     $.ajax({
      type: "GET",
      url: "./app.py",
      //data: { param: text}
      success: function (response) {
         console.log(response);
       },
       error: function (error) {
           console.log(error);
       }
    })
  </code></pre>
  
  <p>And my <code>aap.py</code> python code -</p>
  
  <pre><code>import csv
  from numpy import matrix
  
  def main():
      x =2
      return x
  if __name__ == "__main__":
      x=main()
  </code></pre>
  
  <p>But after running this code I am simply getting whole python code inside console.
  What I am doing wrong here? How to run python file inside js?</p>