How to put the value returned by ajax into the text box and make it editable. . Solve.
For example, the data obtained like this. .
http://bbs.csdn.net/topics/390542453
If there is no file box, create one and put the return value in For example, in the file box:
$('
If you have it, you can put it directly
$('#id value').val('return value')
If there is no file box, create one and put the return value in the file box. For example:
$('
If you have it, you can put it directly
$('#id Value').val('return value')
Ask for the specific code. ?
For example, the text box looks like this, how to put it. ?
Simply write
Server side
<?phprequire 'global.php';echo $_GET['name']."abc";?>
<!DOCTYPE html><html> <head> <title>this is demo</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script> </head> <body> <div> <dl> <dt>输入数据</dt> <dd><input type="text" name="inC" /></dd> </dl> <input type="button" value="发送" id="btn" /> </div> <div> <dl> <dt>接受数据</dt> <dd><input type="text" name="onC" /></dd> </dl> </div> <script type="text/javascript"> jQuery(function($){ $('#btn').click(function(){ $.ajax({ url: "/first.php", type: "GET", data: 'name='+$('input[name=inC]').val(), beforeSend: function(){ $('#btn').attr('disabled','true').attr('value','send data'); }, success: function(d){ $('input[name=onC]').val(d); } }); }); }); </script> </body></html>
Thanks, I’ll give it a try.