jwk811 Posted November 6, 2006 Share Posted November 6, 2006 could you? or could you include a function or file of php? or no? Link to comment https://forums.phpfreaks.com/topic/26264-can-you-use-php-in-a-javascript-file/ Share on other sites More sharing options...
ToonMariner Posted November 6, 2006 Share Posted November 6, 2006 you can use php to develop js or you can use ajax for js to execute some php code on the fly. Link to comment https://forums.phpfreaks.com/topic/26264-can-you-use-php-in-a-javascript-file/#findComment-120120 Share on other sites More sharing options...
btherl Posted November 6, 2006 Share Posted November 6, 2006 If you want to generate javascript using php, then yes you can. Just set your script tag to point to the php script, and have your php script output javascript.But there is no way to "include" a php file from plain javascript. Like Toon said, you can use ajax to call a php script from javascript and get the results. Link to comment https://forums.phpfreaks.com/topic/26264-can-you-use-php-in-a-javascript-file/#findComment-120161 Share on other sites More sharing options...
jwk811 Posted November 8, 2006 Author Share Posted November 8, 2006 ok say i want to check a form to see if there is input in each place.. id put onSubmit="check.js" and in the check .js file i can have php in it? and how could i get it to out put an alert if there was no input? could you please give me something to look at? thank you Link to comment https://forums.phpfreaks.com/topic/26264-can-you-use-php-in-a-javascript-file/#findComment-121720 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.