웹개발 2주차

JoonQpa·2022년 4월 16일
0

2주차 주요내용

  • Ajax, JQuary 사용하기
  • 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/bootstrap@5.0.2/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/bootstrap@5.0.2/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="name@example.com">
        <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>입력하세요
profile
Intuition factory: from noob to pro

0개의 댓글

관련 채용 정보