I have seen this topic: ajax request to python script where they were trying to do exactly what I need but there is one information missing.
$.post('myPythonFile.py',{data},
function(result){
//TODO
}
);
Now my problem is: how do I call a certain function which is inside myPythonFile.py? Is there a way to specify the name of the function and to give it my input data? Thank you very much for your time.
globals()
in python, it will return a dict which stores all name in your current module. For example, you want to callMyfunction
: send text{text:"Myfunction"}
in json form, then in your py callglobals()[request.text]()
. it should be called. – Herrington Darkholme May 2 '13 at 13:51