zoukankan      html  css  js  c++  java
  • 2021年5月13日

    时间:2个小时左右

    代码:159行左右

    博客:1

    知识点:异步编程、promise

    <!DOCTYPE html>
    <html lang="en">
    <head>
      <meta charset="UTF-8">
      <title>Document</title>
    </head>
    <body>
      <div>前后端交互</div>
      <script type="text/javascript" src="js/jquery.js"></script>
      <script type="text/javascript">
        /*
          前后端交互-异步编程与Promise概述
        */
        // var ret = '---';
        // $.ajax({
        //   url: 'http://localhost:3000/data',
        //   success: function(data) {
        //     ret = data;
        //     console.log(ret)
        //   }
        // });
        // console.log(ret)
    
        // ----------------------------
        // $.ajax({
        //   url: 'http://localhost:3000/data',
        //   success: function(data) {
        //     console.log(data)
        //   }
        // });
        // $.ajax({
        //   url: 'http://localhost:3000/data1',
        //   success: function(data) {
        //     console.log(data)
        //   }
        // });
        // $.ajax({
        //   url: 'http://localhost:3000/data2',
        //   success: function(data) {
        //     console.log(data)
        //   }
        // });
        // -----------------------------------
        $.ajax({
          url: 'http://localhost:3000/data',
          success: function(data) {
            console.log(data)
            $.ajax({
              url: 'http://localhost:3000/data1',
              success: function(data) {
                console.log(data)
                $.ajax({
                  url: 'http://localhost:3000/data2',
                  success: function(data) {
                    console.log(data)
                  }
                });
              }
            });
          }
        });
        
        
        
      </script>
    </body>
    </html>
  • 相关阅读:
    pspc命令使用(转)
    NSArray数组的使用常用方法(转)
    css兼容的问题 持续更新
    关于memcache
    drupal7 学习笔记(持续更新中...)
    JavaScript的继承 转载
    浏览器的缓存机制
    我的js单例模式
    javascript运行机制
    javascrpt绑定事件之匿名函数
  • 原文地址:https://www.cnblogs.com/j-y-s/p/14903330.html
Copyright © 2011-2022 走看看