title: Can't add new lines in JavaScript alert Box?
body: <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 = &quot;This is a string\n&quot;;
  $alert = $str.&quot;This is the second line&quot;; 
  
      if(!empty($alert)){
          ?&gt;
              &lt;script type=&quot;text/javascript&quot;&gt;
              $(document).ready(function() {
                  alert('&lt;?=$alert?&gt;');
              });
          &lt;/script&gt;
      &lt;?php
  }
  </code></pre>
  <p>I'm getting the error:</p>
  <blockquote>
  <p>Undeterminnated string literal</p>
  </blockquote>
  <p>If I remove the <code>\n</code> from the string it works 100% but without line breaks.</p>