How do I populate second textbox based on the value entered in first textbox using jquery?
<p>I am trying to populate the text fields based on the value entered in the first textbox field from the database but I am not getting any response when I enter some value into the first textbox field. Please check the code</p>

<p>Javascript:</p>

<pre><code> &lt;script type="text/javascript"&gt;
    $("#tin").blur(function () {
    $.post("tin_handle.php",
           {
               tin: $(this).val() 
        }, 
    function (data){
        $("#cname").val(data.cname);
        $("#caddress").val(data.caddress);
    });

&lt;/script&gt;
</code></pre>

<p>Tin_handle.php:</p>

<pre><code>&lt;?php
    $tn = trim($_POST['tin']);

    require_once("sqlconnect.php");

    $q="SELECT CONCAT(address,',',city,',',state) AS caddress,cname,tin FROM company WHERE tin=$tn;                                                                          

    $r = @mysqli_query ($dbc, $q);

    //$arr=array();
    while ($row = mysql_fetch_array($r))
    {

        $arr=array('cname'=&gt;$cname, 'caddress'=&gt;$caddress);
        echo json_encode($arr);

    }

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