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:
$(document).ready(function() {
var test = $.cookie('tet');
$.cookie('tet','8');
<?php
if (isset($_SESSION['main_check_a'])) {
echo "$.cookie('tet','1');";
?>
}}
}
How can i pass this PHP code to my external JS?