Correction status:qualified
Teacher's comments:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>ajax()注册提交</title> </head> <body> <h2>用户注册</h2> <p>账号 <input type="text" name="name" id="name"> <span></span> </p> <p>密码 <input type="password" name="password"> </p> <button>提交</button> </body> </html> <script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script> <script type="text/javascript"> $('#name').blur(function() { $.ajax({ url: 'api/info.php', type: 'GET', async: true, data: {'name': $('#name').val()}, success: function(msg, status, xhr){ $('p span').empty(); $('p span').append($(msg)); } }) }) </script>
点击 "运行实例" 按钮查看在线实例