summaryrefslogtreecommitdiff
path: root/examples/amd/index.html
blob: 1b10d2be8c01627d10e98007a8f1db4390a45c4a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<!doctype html>
<html>
  <head>
    <title>AMD</title>
    <link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"/>
  </head>
  <body class="container">
    <h1>AMD</h1>
    
    <div>
      <h3>User</h3>
      <div class="row">
        <img id="useravatar" src="" class="col-md-1"/>
        <div class="col-md-3">
          <strong id="username"></strong>
        </div>
      </div>
    </div>

    <script src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.16/require.min.js"></script>
    <script>
      requirejs.config({
        paths: {
          axios: '/axios.min'
        }
      });

      requirejs(['axios'], function (axios) {
        axios.get('https://api.github.com/users/mzabriskie')
          .then(function (user) {
            document.getElementById('useravatar').src = user.data.avatar_url;
            document.getElementById('username').innerHTML = user.data.name;
          });
      });
    </script>
  </body>
</html>