澄清: 我通过Apache web服务器以cgi的身份运行这个程序。这不是问题所在 我的问题是当我通过ajax请求调用Python脚本时,如何指定该脚本中要运行的函数。
我读了一篇教程,上面说要把要调用的函数名作为变量传递,我做到了。 在Python里,我试过
这是我的ajax函数
$(document).ready(function() {
$.ajax({
url: "monStat.py",
type: "post",
data: {'callFunc':'isRunning'},
success: function(response){
$('#blurg').html(response).fadeIn(1500);
}
});
});
这是Python
def main():
if callFunc:
funcResp = isRunning()
else:
print("No function passed")
def isRunning( process_name ):
''' the content '''
目前没有回答
相关问题 更多 >
编程相关推荐