View Full Version : Can I put PHP code inside Javascript .js file?
dealmaker
01-10-2006, 06:13 PM
Hi,
I have a javascript .js file, can I have php code like <?=$myvar;?> inside the .js file? will it work?
many thanks.
If your server is set to parse .js as php, then yes.
Otherwise, you can change the filename to .php and that will work too...
Velox Letum
01-10-2006, 07:11 PM
Either will work, as long as it's parsed. Example .htaccess:
<Files file.js>
ForceType application/x-httpd-php
</Files>
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.