how to pass a php values to javascript?
<p>here is the code??</p>

<p>posting code:</p>

<pre><code>$.post('get.php',{selected:"aaaa"},function(return){alert(return);});
</code></pre>

<p>when i check the values of "selected" value using </p>

<pre><code>&lt;?php

$r=$_POST['selected'];
echo $r;

?&gt;
</code></pre>

<p>is displays the value "aaaa" correctly..</p>

<p>this code works fine...</p>

<pre><code>&lt;?php 

$r=$_POST['selected'];
?&gt;
var answer="&lt;?php echo "welcome" ?&gt;";
</code></pre>

<p>when we echo the value"welcome" it is stored in the variable answer.and i could print that...</p>

<p>but when i put like this....</p>

<pre><code>&lt;?php 

$r=$_POST['selected'];
?&gt;
var answer="&lt;?php echo $r ?&gt;";
</code></pre>

<p>an empty value is stored in answer... and nothing gets displayed.... </p>

<p>whether specifying $r inside " " is not right... how to specify that......</p>
