Passing PHP SESSION info into JQuery
<p>I am trying to pass a PHP Session variable into a js function but failing.</p>

<p>Here's what I'm trying. The desired end result is that it reads the correct JSON file based on user logged in details.</p>

<p>Is this even possible?</p>

<pre><code>var username = &lt;?=$_SESSION[username]?&gt;;
$('#aboutContent').redactor({ 
    imageGetJson: '/users/'+username+'/gallery/gallery.json'
    }); 
}
</code></pre>

<p>I've also tried:</p>

<pre><code>imageGetJson: '/users/&lt;?=$_SESSION[username]?&gt;/gallery/gallery.json'
</code></pre>

<p>But still no dice.</p>

<p><strong>UPDATE - FIXED</strong></p>

<p>The problem was that this js was in an external file, not in the same file where the session_start is called - so i moved it into the file as opposed to extrenal and all is good now. Using this and works perfectly (don't need to set var username):</p>

<pre><code>imageGetJson: '/users/&lt;?=$_SESSION['username']?&gt;/gallery/gallery.json'
</code></pre>
