I have this PHP code which I use to populate my HTML:
<?php $xml = simplexml_load_file("txt/main.xml", null, LIBXML_NOCDATA); ?>
And then I use this JS code to get the xml for use with internal vars:
window.xml = <?php echo json_encode($xml); ?>;
When I "view source" in my browser, the entire xml string is displayed like so:
window.xml = {"comment":[{}, etc. etc., LONG STRING OF TEXT FOR ALL SITE XML, etc. etc.]};
I've read read this post already: How to pass variables and data from PHP to JavaScript?
I'd like to continue with json_encode if possible - is there a way to hide the JS variable from the HTML source?