Blogger Information
Blog 34
fans 0
comment 0
visits 20528
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
get 获取数据,以及光标事件
小庄
Original
686 people have browsed it

get 获取数据,以及光标事件

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <script src="http://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>
  8. <title>Document</title>
  9. <style>
  10. </style>
  11. </head>
  12. <body>
  13. <div class="container">
  14. <span>请输入用户名:</span><input id="user" type="text" name="" value="请输入用户名">
  15. <span>请输入密 码:</span><input id="pwd"type="text" name="">
  16. </div>
  17. <br>
  18. <div>
  19. <table border="1" cellspacing="0" cellpadding="0">
  20. <thead>
  21. <tr>
  22. <td>编号</td>
  23. <td>名称</td>
  24. <td>首字母</td>
  25. <td>拼音</td>
  26. <td>精度</td>
  27. <td>纬度</td>
  28. </tr>
  29. </thead>
  30. <tbody>
  31. </tbody>
  32. </table>
  33. </div>
  34. <script>
  35. // 按键松开后(还有按键按下等,具体需要可查阅api文档
  36. $('#user').keyup(function(){
  37. console.log(123);
  38. });
  39. // 获取焦点
  40. $('#user').focus(function(){
  41. $('#user').val("");
  42. });
  43. // 失去焦点
  44. $('#user').blur(function(){
  45. $('#user').val("请输入用户名");
  46. });
  47. // get
  48. $.get("http://admin.ouyangke.cn/index.php/api/index/prov_list",
  49. {
  50. // page:7,
  51. limit:20
  52. },function(data){
  53. let html_data = "";
  54. // console.log(data);
  55. // console.log(data.data.length);
  56. for(let i = 0;i < data.data.length; i++){
  57. html_data += "<tr>"
  58. html_data += "<td>" + data.data[i].area_id + "</td>";
  59. html_data += "<td>" + data.data[i].area_name + "</td>";
  60. html_data += "<td>" + data.data[i].first_pinyin + "</td>";
  61. html_data += "<td>" + data.data[i].lat + "</td>";
  62. html_data += "<td>" + data.data[i].lng + "</td>";
  63. html_data += "<td>" + data.data[i].pinyin + "</td>";
  64. html_data += "</tr>"
  65. }
  66. $('tbody').append(html_data);
  67. },'JSON');
  68. </script>
  69. </body>
  70. </html>
Correcting teacher:PHPzPHPz

Correction status:qualified

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!