3
Galera set up a very simple function of Alert in php. It works however this presenting a problem.
Whenever I call him that:
Alert("Pedido finalizado");
It works, but when I put an n to have a break if line, it doesn’t work. Example:
Alert("Pedido \n finalizado");
Does anyone know what it might be? in the browser the only error that appears and this:
SyntaxError: Unexpected EOF
Good follows the function:
function Alert($msn){
?>
<script>
alert('<?=$msn?>');
</script>
<?php
}
it worked like this. but I didn’t understand why
– Hugo Borges
When you use
\n
in the variable, it already interprets scape, and when it passes to Alert, it is no longer there. Using two, it interprets one, and the other Alert.– Samir Braga
OK thanks so much for the help and removal
– Hugo Borges
But, another thing, I don’t know much about php, but this <script> shouldn’t come in one
ècho
something like this, I think the EOF error refers to this. Or not? (taking doubt :P )– Samir Braga
It works in echo tbm, but so the code gets much more organized. And the issue of EOF was n
– Hugo Borges
Ah ok, all right. Thank you :)
– Samir Braga