I want to use PHP variable in .JS file. When I am declare JAVASCRIPT variable with store PHP VARIABLE VALUE, it gives me error of
Expected an identifier and instead saw '<'Expected an operator and instead saw '?'Missing ";" before statementMissing semicolonExpected an identifier and instead saw '>'Expected ':' and instead saw ';';
and when I store data with inverted comma then
code:
$disabledDates = <?PHP echo $json_array?>;
console.log($disabledDates);
Then it prints <?PHP echo $json_array?>
not an array value; please can help me with it. How can I use it to store PHP variable.