The case is that I have a .php file and inside it, I have a function inside script tags. After it, I have php code, that reads from a file. I want to sent the file data to the js function. I had done this before, but now it will produce parsing errors.
SOLUTION
THE file format must not have line breaks!!!!
echo '<script>updateMatch1("'.$filetext.'") </script>';
Here is the code
<script>
function updateMatch1(names) {
alert(names);
};
</script>
<?php
/* Read file */
...
$filetext = fread( $file, $filesize ); //checked the output, it's ok
// numerous ways I tried. Some produce an error and the page isn't loaded at all,
// while others produce an error in the console
echo "<script>updateMatch1('" . $filetext . "');</script>";
//echo '<script> updateMatch1($filetext);</script>';
//echo '<script>updateMatch1();</script>';
//echo "<script>updateMatch1($filetext" . ")</script>";
//echo "<script>updateMatch1($filetext)</script>";
//echo '<script>updateMatch1(' . $filetext . ');</script>';
?>