title: PHP Javascript Uncaught SyntaxError: Unexpected token ILLEGAL
body: <p>I have this PHP script and it does not work properly. What is the mistake?  </p>
  
  <pre><code>&lt;?php
  if ( isset($success) || isset($failure) ) {
  ?&gt;
  &lt;script&gt;
      $(document).ready(function(){
          $('div.aler').css('display','block');
          $("div.aler").html("&lt;?php if($success){echo '&lt;p class=\"success\"&gt;'.$success.'&lt;/p&gt;';} elseif($failure) {echo '&lt;p class=\"failure\"&gt;'.$failure.'&lt;/p&gt;';}; ?&gt;");
          setTimeout(function(){
              $("div.aler").fadeOut("slow", function (){
                  $("div.aler").remove();
              });
          }, 5000);
      });
  &lt;/script&gt;
  &lt;?php }  
  </code></pre>
  
  <p>I think there must be a problem with quotes:</p>
  
  <pre><code>" . $failure
  </code></pre>
  
  <p>has the message, but the JavaScript does not put it in HTML div:</p>
  
  <pre><code>div.aler
  </code></pre>
  
  <p>I get this error message in the Chrome console:</p>
  
  <blockquote>
    <p>Uncaught SyntaxError: Unexpected token ILLEGAL</p>
  </blockquote>