title: append php in jquery
body: <p>I'm trying to dynamically create a div to show error messages using jquery. I'm able to use append() to create the HTML easily enough, but I need to call a php variable in order to display the content. If I just try adding php opening and closing tags like I would ordinarily, the append method doesn't behave as expected and outputs a seemingly random section from the middle of the line.
  How can I overcome this problem?</p>
  
  <p>Here's the jquery code as I have it:</p>
  
  <pre><code>$(document).ready(function() {
      var errors_php = "&lt;?php  echo validation_errors('&lt;li&gt;','&lt;/li&gt;'); ?&gt;";
      $('#wrapper').append("&lt;div id='errors'&gt;&lt;ul&gt;"+errors_php+"&lt;/ul&gt;&lt;/div&gt;");
      $('#errors').slideDown('slow');
  });
  </code></pre>
  
  <p>Note: the validation_errors() function is a codeigniter method. Incidentally, if I remove the errors_php variable from the append() it works as expected, displaying an empty div.</p>
  
  <p>EDIT:</p>
  
  <p>The generated code is:</p>
  
  <pre><code>&lt;div id="errors"&gt;&lt;ul&gt;',''); ?&amp;gt;&lt;/ul&gt;&lt;/div&gt;
  </code></pre>