I\'m generating a string in PHP and then eventually passing this string into a JavaScript alert box, my problem is I actually can\'t add line breaks in my alert box.
My c
You need to change $str to
$str
$str = "This is a string\\n";
so that the \n gets passed to the JavaScript.
\n