Skip to content

Instantly share code, notes, and snippets.

@perXautomatik
Created December 16, 2019 07:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save perXautomatik/7ffc39e5b7b8946db2d21a07fa1fad00 to your computer and use it in GitHub Desktop.
Save perXautomatik/7ffc39e5b7b8946db2d21a07fa1fad00 to your computer and use it in GitHub Desktop.
Call Python function from JavaScript code
//@https://stackoverflow.com/questions/13175510/call-python-function-from-javascript-code
//All you need is to make an ajax request to your pythoncode. You can do this with jquery http://api.jquery.com/jQuery.ajax/, or use just javascript
$.ajax({
type: "POST",
url: "~/pythoncode.py",
data: { param: text}
}).done(function( o ) {
// do something
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment