score:1

Accepted answer

looks like in var treedatajson = "filtered_tree.json"; when it worked you were passing in the filename, and in var treedatajson = JSON.parse(window.SESSION.filtered_tree); you were passing in the json data. What is the next line where you use treedatajson? You are probably looking for a filename there instead of the parsed data.

... or maybe you should create a php endpoint that serves the session data as json... something like

<?php
// filtered-tree.php
session_start()
header('Content-Type: application/json');
echo json_encode($_SESSION['TREE']); // or whatever the key is

and then in js

var treedatajson = "filtered-tree.php";

Related Query