Calling PHP within Javascript results in literal string of function
<p>I feel like i'm going round in circles here and missing something really daft...</p>

<p>My setup is essentially using CodeIgniter on the server-side, and Bootstrap on the client, but that's a little beside the point...</p>

<p>I'm trying to call a php value within a javascript function.  The value is being stored in a protected variable within one of the php controllers, which is accessible by the views being loaded in that controller, as i'm accessing the variable directly in the html (and therefore I assumed i could access it in the javascript as well).</p>

<p>The code is here, it's really straight forward:</p>

<pre><code>$(document).ready(function() {
    var UID = "&lt;?php echo $the_user-&gt;id; ?&gt;";
    console.log(UID);
});
</code></pre>

<p>I'm expecting this do do a console output of, say, "1", but it's actually outputting the actual string of <code>"&lt;?php echo $the_user-&gt;id; ?&gt;"</code>.  This will also happen if i'm just echoing a simple string, rather than a php variable.</p>

<p>I feel like this might be a config issue, but I really have no idea.  If I remove the quotes from the php call, I get a</p>

<pre><code>TypeError: can't wrap XML objects   
console.log(&lt;?php echo $the_user-&gt;id ?&gt;);
</code></pre>

<p>Any ideas?  I feel really dumb at this point :(</p>
