Call Python function from Javascript code -
I want to call the Javascript part: contains functions that use advanced libraries, which are not easy to write in JavaScript, You only need to unplug your python Terrorism is a customizable Ajax request. You can do this with jquery, or just use javascript Python function to
Javascript because There is no option in
javascript for whatever I want. Is this possible? Can you adjust the snippet below to work?
var tag = document.getElementsByTagName ("p") [0]; Text = tag.inner HTML; // Here I would like to call Python Interpreter with Python Function arrOfStrings = openSomehowPythonInterpreter ("~ / pythoncode.py", "Process paragraph (text)"); ~ / Pythoncode.py
import nltk # javascript Not in the DEF process paragraph (text): ... nltk calls ... returns LST # returns the list of strings (this will be converted to 'javascript' array)
$ Ajax ({type: "POST", url: "~ / pythoncode.py", data: {param: text}}) .done (function (o) {// do something});
Comments
Post a Comment