Click here to Skip to main content
14,691,021 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi friends, I am try with require_once() through include a php file that contains javascript function and its work proparly but i want to require call the javascript function in another php file without using require_once()

Updated 11-Mar-14 20:10pm

1 solution

Put your javascript function in an external file and save is as say myScript.js, then to point to this js file, include in your php or html file header the following line:
<script type="text/javascript" src="myScript.js"></script>
Jeenita 12-Mar-14 3:00am
I have javascript function in php file and i dont want to use external javascript file so that's why your solution is excellent but not satisfied...
Peter Leow 12-Mar-14 3:04am
Why not? move the javascript code out of that php file to an external file, then you can include this external js file in any php or html files. That promotes re-usability.
Jeenita 12-Mar-14 3:29am
you are absolutely right but i have not rights from my head for create any new file so that's why....

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900