writing JavaScript with PHP
<p>I am trying to right some some JavaScript to define a variable using PHP.  The variable has a little jQuery in it which should get rendered by the client.  I say "should" but really mean I want it to. What should I do to make o2 the same as o1 (i.e. covert the jQuery)?</p>

<p>Thank you!</p>

<pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; 
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; 
&lt;head&gt; 
&lt;meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" /&gt; 
&lt;title&gt;&lt;/title&gt; 
&lt;script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"&gt;&lt;/script&gt; 
&lt;script&gt;
$(function() {
    var o1={"foo":{"bar": "abc/index.php?="+$("#id").val()}};
    console.log(o1);
&lt;?php
$d='abc/index.php';
$json='{"foo":{"bar": "'.$d.'?id=\"+$(\"#id\").val()"}}';
//echo($json);
$json=json_decode($json);
//echo(print_r($json,1));
$json=json_encode($json);
//echo($json);

echo("var o2=".$json.";");
?&gt;

console.log(o2);
});

&lt;/script&gt;

&lt;/head&gt;

&lt;body&gt;
&lt;input type="hidden" id="id" value="123" /&gt;
&lt;/body&gt; 
&lt;/html&gt; 
</code></pre>
