Snippets

Run PHP code inside JavaScript

Insert this code into your site .htaccess file.

AddType application/x-httpd-php .js
AddHandler x-httpd-php5 .js

<FilesMatch ".(js|php)$">
SetHandler application/x-httpd-php
</FilesMatch>

Source: http://www.kavoir.com/2010/07/how-to-execute-run-php-code-in...

Share this snippet