커뮤니티
포인트
쿠폰
내 강의실
국비 신청 내역
증명서
계정
로그아웃
학습 질문
개발 일지
나의 활동
답변 완료
2주차 숙제인데 곤솔창이랑 팝업창에서 다 뜨는데 왜 span 에는 못 가져 올까요?도와 주세요
undefined주차
북마크
김*태
댓글
3
추천
0
조회수
14
조회수
14
답변 완료








작성한 코드 및 에러 메세지

<!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>015B 팬명록</title>

    <style>
        .mytitle {
            width: 100%;
            height: 300px;

            background-image: linear-gradient(0deg, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url("http://www.busan.com/nas/data/content/image/2015/11/11/20151111000152_0.jpg");
            background-position: center;
            background-size: cover;
            color: white;

            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;

    }
                .mypost {
            width: 95%;
            max-width: 500px;
            margin: 20px auto 20px auto;

            box-shadow: 0px 0px 3px 0px black;
            padding: 20px;
        }
        .mypost > button {
            margin-top: 20px;
        }
        .mycards {
            width: 95%;
            max-width: 500px;
            margin: auto;
        }
        .mycards > .card {
            margin-top: 10px;
            margin-bottom: 10px;
        }
        .mytemp{
            border:2px solid red;
        }
    </style>
    <script>
        $(document).ready(function () {
        $.ajax({
          type: "GET",
          url: "http://spartacodingclub.shop/sparta_api/weather/sangju",
          data: {},

          success: function (response) {

            let temp_temp = response['temp']

            let temp_html = `<span class="mydo">${temp_temp}</span>`

            $('#mydo').text(temp_html)

            console.log(temp_temp)
//           alert(temp_html)
          }
        })
        });
    </script>
</head>

<body>
    <div class="mytitle">
        <h1>015B 팬명록</h1>
        <p class="mytemp">현재기온:<span class="mydo"> </span>도</p>
    </div>
        <div class="mypost">
            <div class="form-floating mb-3">
                <input type="text" class="form-control" id="name" placeholder="url">
                <label for="floatingInput">닉네임</label>
            </div>
            <div class="form-floating">
            <textarea class="form-control" placeholder="Leave a comment here" id="comment"
                      style="height: 100px"></textarea>
                <label for="floatingTextarea2">응원 댓글</label>
            </div>
            <button onclick="save_comment()" type="button" class="btn btn-dark">응원 남기기</button>
        </div>


    <div class="mycards" id="comment-list">
        <div class="card">
            <div class="card-body">
                <blockquote class="blockquote mb-0">
                    <p>새로운 앨범 너무 멋져요!</p>
                    <footer class="blockquote-footer">호빵맨</footer>
                </blockquote>
            </div>
        </div>
        <div class="card">
            <div class="card-body">
                <blockquote class="blockquote mb-0">
                    <p>새로운 앨범 너무 멋져요!</p>
                    <footer class="blockquote-footer">호빵맨</footer>
                </blockquote>
            </div>
        </div>
        <div class="card">
            <div class="card-body">
                <blockquote class="blockquote mb-0">
                    <p>새로운 앨범 너무 멋져요!</p>
                    <footer class="blockquote-footer">호빵맨</footer>
                </blockquote>
            </div>
        </div>
    </div>
</body>

</html>

오류 발생 시, 작성한 코드 전체와 에러 메시지를 첨부해 주세요.

Tip 1) </> 아이콘을 눌러 코드박스를 만들어 보세요.

Tip 2) Ctrl+A(맥의 경우 Command+A) 단축키로 코드를 한 번에 선택할 수 있어요!




취소
 공유
취소
댓글 0
댓글 알림
나의얼굴