jquery - I am getting response from php but not printing in text box -
i have 2 files, 1 html , jquery , other php.
getting response php page, not able display in html text box.
here code:
<script type="text/javascript"> function fill_amt() { var sname=$("#sname").val(); $.post("try_insert.php",{sname:sname,cmd2:"fill_amt"},function(data){ $("#tot_amt").html(data); }); } </script>
here html code:
<input type="text" id="tot_amt" name="tot_amt">
here php code
$sql = mysql_query("select total_fee admission first_name='".$sname."'")or die(mysql_query()); $val=mysql_fetch_row($sql); $tot=$val; echo json_encode($tot);
use:
$("#tot_amt").val(data);
instead of $("#tot_amt").html(data);
also format json data correctly.
Comments
Post a Comment