title: Passing PHP variable into JavaScript
body: <p>I've a PHP session variable, <code>$_SESSION['user']</code>, alive throughout the session. In the head section, I've my JavaScript file included, <code>scripts.js</code>. </p>
  
  <p>How do I pass the session variable into the JavaScript file if I want something like the following.</p>
  
  <pre><code>$.("#btn').click (
       function() {
          alert('&lt;?php echo $_SESSION['user']; ?&gt;');
       }
  )
  </code></pre>
  
  <p>As the <code>&lt;?php ?&gt;</code> isn't recognized in the JavaScript file, the code above doesn't work. So I've to put in the PHP file itself, but how do I keep it in the JavaScript file?</p>