javascript&jquery
ajax 1초마다 한번씩 데이터 가져오기
에스크리토
2018. 6. 18. 17:09
반응형
<script>
$(function() {
timer = setInterval( function () {
$.ajax ({
"url" : "http://www.daum.net",
cache : false,
success : function (html) {
console.log(html);
$("#clicks").text(html);
}
});
}, 1000);
});
</script>
<div style="border:1px solid #dedede; width:600px; height:250px; line-height:250px; color:#666;font-size:100px; text-align:center;" id="clicks">
</div>
url에는 리턴값이 있는 주소를 넣어주어야 한다.
반응형