24_异步.html 775 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>Document</title>
  7. </head>
  8. <body>
  9. <script src="./ajax.js"></script>
  10. <script>
  11. // var a = 10;
  12. // setTimeout(function(){
  13. // console.log(a)
  14. // }, 1000);
  15. // a++;
  16. // console.log(a)
  17. //callback hell 回调地狱
  18. ajaxFun("./data/a.json", function (res) {
  19. console.log(res)
  20. ajaxFun("./data/b.json", function (res) {
  21. console.log(res)
  22. ajaxFun("./data/c.json", function (res) {
  23. console.log(res)
  24. })
  25. })
  26. })
  27. </script>
  28. </body>
  29. </html>