How to use php and mysql functions inside javascripts
<p>Here is my javascript code which is added in the  tag of my php/html page:</p>



<pre><code>&lt;script type="text/javascript"&gt;

    $(document).ready(function() {  

        $('#status').change(function(){

           var status = $('#status').val();                  
           var html = ''; //string variable for html code for fields 

           if( status=="closed"){

               html += '&lt;th&gt;Close By :&lt;/th&gt;&lt;td align="left"&gt;&lt;select name="close_by"&gt;'+&lt;?php $user=mysql_query("SELECT * FROM user");
                        while($data=mysql_fetch_array($user)){?&gt;+'&lt;option value="'+&lt;?php echo $data['username'] ?&gt;+'"&gt;'+&lt;?php echo $data['username']; ?&gt;+'&lt;/option&gt;'+&lt;?php } ?&gt;+'&lt;/select&gt;&lt;/td&gt;'; 
            }

            $('#close_by').html(html);
        });
    }); 
&lt;/script&gt;
</code></pre>

<p>The code is for that, if Status=="closed" then a select tag will be appeared and the option values will be fetched from the database using mysql functions.But its not working. Please help to sort out this problem.</p>

<p>Thanks in advance.</p>
