Can't add new lines in JavaScript alert Box?
<p>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.</p>

<p>My code looks as follows</p>

<pre><code>$str = "This is a string\n";
$alert = $str."This is the second line"; 

     if(!empty($alert)){
              ?&gt;
               &lt;script type="text/javascript"&gt;
                $(document).ready(function() {
                 alert('&lt;?=$alert?&gt;');
                });
               &lt;/script&gt;
              &lt;?php
             }
</code></pre>

<p>I'm getting the error</p>

<p>Undeterminnated string literal</p>

<p>If I remove the \n from string it works 100% but without line breaks</p>
