Good morning
I have a problem with a JavaScript variable that I'm trying to initialize with a PHP json_encode (), but then when I inspect the code of the page;
there is nothing inside the variable, that is, as if there was nothing inside the PHP variable, but I can attest that this variable is initialized and has data ... (in fact it is an array) Here I leave the code ...
if (isset($_SESSION['cesta']))
{
$cesta = $_SESSION['cesta']; // Aquí inicializo la variable de PHP que
// viene cargada con los productos
}
var cart = <?php echo json_encode($cesta); ?>; // variable que intento pasar
// a JavaSCript
Note that the JavaScript is embedded in a PHP document.
Is there anything I'm doing wrong?