I am calling a PHP file to get the requested XML file and storing its data to a JavaScript variable. Here is the code:
var albumXML = null;
<?php $fname = "folder/" . $_GET['getFile'];
$contents = file_get_contents($fname);
echo 'albumXML = "' . $contents . '";';
?>
But the console shows the error: Uncaught SyntaxError: Unexpected token <
I think it's the starting of the $contents's first tag start. How can I store that data?
$contentsvariable?. Even if you have an error doing right-click and checking source code helps a ton sometimes to detect strange behaviors