JQuery/work
뉴스기사 읽어오기 전 // 로딩중...
웨이칭
2020. 7. 17. 12:37
html
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
</head>
<body>
<!-- 파일 읽어오기 -->
<!-- onload -->
<div id="news">로딩중...</div>
<script type="text/javascript">
$(document).ready(function() {
$("#news").load("news.txt", function (txt, status) {
//읽어온 문자열
alert(status); //success
//alert(txt); //news.txt의 내용
});
});
</script>
news.txt
뉴스 아무거나~~~~~~~~~