Web開発2週目

30746 ワード

第2週の主な内容

  • Ajax、JQuery
  • を使用
  • APIサーバからのデータの呼び出しおよび出力
  • 코드를 <!doctype html>
    <html lang="en">
    
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    
        <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
              integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
        <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
                integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
                crossorigin="anonymous"></script>
    
        <title>Boo's fan page by JoonQpa</title>
        <link href="https://fonts.googleapis.com/css2?family=Gugi&display=swap" rel="stylesheet">
    
    
        <style>
            * {
                font-family: 'Gugi', cursive;
            }
    
            .mytitle {
    
                width: 100%;
                height: 250px;
    
    
                background-image: linear-gradient(0deg, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url("https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/f/9b67e23c-c0b9-401c-9578-26e78a1c198f/d7gan54-102357d7-f053-4034-beec-de7ccb07f5c4.png?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1cm46YXBwOjdlMGQxODg5ODIyNjQzNzNhNWYwZDQxNWVhMGQyNmUwIiwiaXNzIjoidXJuOmFwcDo3ZTBkMTg4OTgyMjY0MzczYTVmMGQ0MTVlYTBkMjZlMCIsIm9iaiI6W1t7InBhdGgiOiJcL2ZcLzliNjdlMjNjLWMwYjktNDAxYy05NTc4LTI2ZTc4YTFjMTk4ZlwvZDdnYW41NC0xMDIzNTdkNy1mMDUzLTQwMzQtYmVlYy1kZTdjY2IwN2Y1YzQucG5nIn1dXSwiYXVkIjpbInVybjpzZXJ2aWNlOmZpbGUuZG93bmxvYWQiXX0.xXBq34u30Ikc76qjTGu0agLG9LZVtueV92fok5n2Ctk");
                background-position: center;
                background-size: cover;
    
                color: white;
    
                display: flex;
                flex-direction: column;
                justify-content: center;
                align-items: center;
            }
    
            .mypost {
                max-width: 500px;
                width: 95%;
    
    
                margin: 20px auto 0px auto;
                box-shadow: 0px 0px 3px 0px gray;
                padding: 20px;
            }
    
            .card {
                max-width: 500px;
                width: 95%;
    
    
                margin: 20px auto 0px auto;
                box-shadow: 0px 0px 3px 0px gray;
                padding: 20px;
            }
    
            .mybtn {
                display: flex;
                flex-direction: row;
                align-items: center;
    
                margin-top: 10px;
    
            }
        </style>
        <script>
            $(document).ready(function () {
                $.ajax({
                    type: "GET",
                    url: "http://spartacodingclub.shop/sparta_api/weather/seoul",
                    data: {},
                    success: function (response) {
                        let temp = response['temp']
                        
                        $('#temp').text(temp)
                    }
                })
            });
        </script>
    </head>
    
    <body>
    <div class="mytitle">
        <h1>Sneaky Boo is coming to ur back!!</h1>
        <p>temp : <span id="temp">00.0</span>C</p>
    </div>
    <div class="mypost">
        <div class="form-floating mb-3">
            <input type="email" class="form-control" id="floatingInput" placeholder="[email protected]">
            <label for="floatingInput">ID</label>
        </div>
        <div class="form-floating">
            <textarea class="form-control" placeholder="Leave a comment here" id="floatingTextarea2"
                      style="height: 100px"></textarea>
            <label for="floatingTextarea2">Cheering comment</label>
        </div>
        <div class="mybtn">
            <button type="button" class="btn btn-dark">Save</button>
    
        </div>
    </div>
    <div class="card">
        <div class="card-body">
            <blockquote class="blockquote mb-0">
                <p>You just so cute!</p>
                <footer class="blockquote-footer"> Joon</footer>
            </blockquote>
        </div>
    </div>
    <div class="card">
        <div class="card-body">
            <blockquote class="blockquote mb-0">
                <p>Plz don't follow me :/</p>
                <footer class="blockquote-footer"> Mario</footer>
            </blockquote>
        </div>
    </div>
    <div class="card">
        <div class="card-body">
            <blockquote class="blockquote mb-0">
                <p>Shhhhhh...</p>
                <footer class="blockquote-footer"> Booo</footer>
            </blockquote>
        </div>
    
    </body>
    
    </html>입력하세요