
현 시간이랑 명언 랜덤으로 나오는게 안되네요,,ㅠㅠ 분명 똑같이 한 것 같은데 어디가 문제인지 모르겠어요ㅠㅠㅠ

<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery.min.js"></script>
<title>나만의 동기부여 홈화면 만들기</title>
<script src="index.js"></script>
<style>
@import url('https://fonts.googleapis.com/css2?family=poppins:wght@500&display=swap');
* {
font-family: 'poppins', sans-serif;
}
body {
background-image: url("https://4.bp.blogspot.com/-CfXgrQpNcdM/TaC1uePaL4I/AAAAAAAAACs/QO9oSy5VWNE/s1600/0-rome-wallpapers-1024.jpg");
background-repeat: no-repeat;
background-size : cover;
background-position: center;
width: 100vw;
height: 80vh;
color: white;
}
.time {
font-size: 120px;
font-wegiht: bold;
}
.greeting {
font-size: 50px;
}
.todo {
font-size: 20px;
}
.author {
font-size: 25px;
font-style: italic;
}
.main {
width: 100vw;
height: 80vh;
display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.quote {
width: 100vw;
height: 20vh;
display: flex; flex-direction: column; align-items: center; justify-content: center;
}
</style>
<script>
</script>
</head>
<body>
<div class="main">
<div id="time" class="time">12:00</div>
<div class="greeting">Hello, Yungsang!</div>
<div class="todo">주 3회 운동하기!</div>
</div>
<div class="quote">
<div id="author" class="author">- 명언의 저자 -</div>
<div id="content" class="content">" 명언의 내용 "</div>
</div>
</body>
</html>
$(document).ready(function () {
renderCurrentTime();
renderQuote();
});
function renderCurrentTime() {
let url = `https://worldtimeapi.org/api/timezone/Asia/Seoul`;
fetch(url)
.then(res => res.json()).then((data) => {
let datetime = data['datetime'].substr(11,5);
$('#time').text(datetime);
});
}
function renderQuote() {
let url = `https://api.quotable.io/random`;
fetch(url)
.then(res => res.json()).then((data) => {
let content = `" ${data['content']} "`;
let author = `- ${data['author']} -`;
$('#content').text(content);
$('#author').text(author);
});
}
