To demonstrate, I will create a PHP object:
<?php $test = array('red'=>'apple', 'yellow'=>'banana', 'orange'=>'orange', 'peach'=>'peach') ?>
var obj = JSON.parse('<?php echo json_encode($test) ?>');
<a id="link" href="">go to script 2</a>
link = document.getElementById('link');
In my test2.php script, I now need to translate the JSON to a php object again:
$var = $_GET['j'];
And there we have it, back in it’s original object form!