Home >Web Front-end >HTML Tutorial >Ajax does not refresh the acquired data, how can I edit_html/css_WEB-ITnose
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:
$('026c666f705047f96ad03dd0b83ad547').attr('value','return value')
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:
$('026c666f705047f96ad03dd0b83ad547').attr('value','return value')
If you have it, you can put it directly
$('#id Value').val('return value')
Ask for the specific code. ?
5250af15673c3e7bf09ffd449f9f08fc
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.