The simple and practical method I found here in the Stack to pass a PHP variable to a JS has worked fine so far. However, with a certain content it works only if I feed this PHP variable, but letting this variable receive that content through a query, no. (NOTE: The complete result set of the query has 13,700 characters.)
<?PHP
$consulta = mysql_query("SELECT MODELO FROM celular_banco");
while($resultado=mysql_fetch_array($consulta))
{
$fracasso .= $resultado["MODELO"].',';
}
echo $fracasso; // LGA270.AVIVBK,LGA270.ACLRBK,
$sucesso = "LGA270.AVIVBK,LGA270.ACLRBK,";
? >
<script>
var duvida = '<?PHP $sucesso;?>';
document.write(duvida); // OK!
</script>
FUNCIONA
<script>
var duvida = '<?PHP $fracasso;?>';
document.write(duvida); // SEM RESULTADO!
</script>
Não FUNCIONA