首页
极刻
圈子
教程
开源
极客社区
写文章
发极刻
建圈子
发项目
登录 / 注册
返回教程:jQuery 教程
TRY RUN / 在线示例
jQuery 教程 尝试一下
jQuery 教程 尝试一下
源代码
运行
<!DOCTYPE html> <html> <head> <script src="//libs.baidu.com/jquery/1.10.2/jquery.min.js"> </script> <script> $(document).ready(function(){ $("input").keyup(function(){ txt=$("input").val(); $.post("demo_ajax_gethint.php",{suggest:txt},function(result){ $("span").html(result); }); }); }); </script> </head> <body> <p>在以下输入框中输入名字:</p> First name: <input type="text" /> <p>匹配项: <span></span></p> <p>该实例的PHP代码 (<a href="demo_ajax_gethint.txt" target="_blank">demo_ajax_gethint</a>) </p> </body> </html>
运行结果