I’m trying to call a function in a .js file from the php page where I’m displaying it!
What I want to do is something like this:
.php file:
... function testFunc(){ return "2"; } ...
now I want to call this function inside the .js file!
Thaks in advance for your help
What you have tried?
Assuming the
testFuncfunction is enclosed in proper script tags,your .js file can call it quite simply like this:
Ideally, you include the .js file after
testFuncis declared.