Javascript js-使用POST&;在表单提交上运行python脚本;路由

Javascript js-使用POST&;在表单提交上运行python脚本;路由,javascript,jquery,node.js,express,Javascript,Jquery,Node.js,Express,我已经按照上的说明安装了pythonshell,并且能够在test.ejs页面加载上运行此代码: var PythonShell = require('python-shell'); var options = { scriptPath: '/nodeGit/scripts', }; PythonShell.run('my_script.py', options, function (err) { if (err) throw err; console.log('finishe

我已经按照上的说明安装了
pythonshell
,并且能够在test.ejs页面加载上运行此代码:

var PythonShell = require('python-shell');
var options = {
    scriptPath: '/nodeGit/scripts',
};

PythonShell.run('my_script.py', options, function (err) {
  if (err) throw err;
  console.log('finished');
});
我把它放在test.js中,让它在test.ejs页面加载上运行。 关于我的test.ejs页面的test.js部分如下所示:

exports.test = function(req, res,callback){

   PythonShell.run('my_script.py', options, function (err, results) {
       if (err) throw err;
  // results is an array consisting of messages collected during execution 
  console.log('results: %j', results);
});

// The functions below were not written by me but were left in to show how functions are written(?) in hopes that it helps

    async.auto({

        getData: function get_data(callback){
            Images.findAll({where: {uploaded: 1}})
            .then(function(getData){
                    callback(null, getData);
                })
            .catch(function(err){
                console.log("*******Did not return Image Info ********");
                callback(err);
            });
        }
    function done(err, results){
        callback({
            userList: results.getUser,
            imageList : results.getData,
            user: results.verifyUser,
        });
    });
}

我不想在页面加载时运行脚本,而是想在提交HTML表单时调用它(&传入表单参数)。我该怎么做呢?

发布的代码都与处理请求的web服务器无关。你是在问如何在快车上投递吗?看来我是。我不知道如何将这些信息应用到我所拥有的东西上,但我需要做的是路由post请求以调用函数。。