javascript - Ajax return value from php to textbox without posting value to php -
i want value php , set textbox.
here ajax code:
function docnum(){ $.ajax({ url: 'docnum.php', datatype: 'json', type: 'post', data: { 'json_encode': $('#tanggal').val() }, success: function(data){ $('#number2').val(data); } }); }
and here html code
<input type="text" id="number2" name="number2" placeholder="number2" onclick="docnum()" />
and here php code docnum.php
<?php $counternew="dummyvariable"; print json_encode($counternew); ?>
why $counternew can not set number2 texbox? please me
Comments
Post a Comment