Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

call python function from javascript

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
});
Comment

call javascript function from python

You need to install js2py or requests-html packages to run the JavaScript program from Python

//example :
//javaScript function : squareofNum()
code in python : 
import js2py

squareofNum = "function f(x) {return x*x;}"

result = js2py.eval_js(squareofNum)

print(result(5))
>>output : 25
Comment

PREVIOUS NEXT
Code Example
Javascript :: ternary javascript 
Javascript :: react image preview npm 
Javascript :: why we use react js 
Javascript :: cookie-parser get cookie 
Javascript :: push an item to array javascript 
Javascript :: how to pass props in react 
Javascript :: anonymous functions in javascript 
Javascript :: reverse integer in for javascript 
Javascript :: slice js 
Javascript :: node js ocr 
Javascript :: javascript regex zero or more occurrence 
Javascript :: what is react js 
Javascript :: javascript validator 
Javascript :: firebase realtime database javascript 
Javascript :: how to delete object in array 
Javascript :: samoglasnici-vowels 
Javascript :: how to append an element to an array in javascript 
Javascript :: javaScript throw statement 
Javascript :: convert json data into html table 
Javascript :: discord bot not responding to commands 
Javascript :: javascript code for find the last element in array 
Javascript :: react native notifications error 
Javascript :: js int 
Javascript :: difference between =, == and === in javascript 
Javascript :: null check in javascript 
Javascript :: React passing data fom child to parent component 
Javascript :: js alerts 
Javascript :: how to upload document cloddinary 
Javascript :: ab mob react native expo 
Javascript :: Differences between detach(), hide() and remove() - jQuery 
ADD CONTENT
Topic
Content
Source link
Name
2+2 =