编辑下面的代码:【加编码】
<html> <head> <script src="https://libs.baidu.com/jquery/1.10.2/jquery.min.js"> </script> <script> $(document).ready(function(){ $("input").keyup(function(){ txt=$("input").val(); $("span").load("demo_ajax_gethint.php",{suggest:txt}); }); }); </script> </head> <body> <p>Start typing a name in the input field below:</p> First name: <input type="text"> <p>Suggestions: <span></span></p> <p>The file used in this example (<a href="/demo/demo_ajax_gethint.txt" target="_blank">demo_ajax_gethint</a>) is explained in our Ajax tutorial</p> </body> </html>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂