using PHP in external JS

shaunliverpool

New Member
I have a big validation JS script. I want to put this script to be external JS.Everything works fine with this, but in the JS i use cookie to handle the my user form junctions.And besides, i use PHP in this JS. If the JS in the html, then works. But if i put it to external, then no.For example:External JS:\[code\]$(document).ready(function() { var test = $.cookie('tet'); $.cookie('tet','8'); <?php if (isset($_SESSION['main_check_a'])) { echo "$.cookie('tet','1');"; ?>}}\[/code\]}How can i pass this PHP code to my external JS?
 
Back
Top