여기 페이지를 자동으로 업데이트하기 위해 jQuery와 javascript를 사용하고 있습니다. A는 URL에서 데이터를 수신 보낼 수 내가 AJAX를 사용하고있는 update()
함수 내에서 다음 데이터는 xmlhttp.responseText
var time = //what the user has selected for when the update should happen
setInterval(function() {
update();
}, time);
function update() {
var xmlhttp;
if(window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
} else {// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=
function() {
if(xmlhttp.readyState==4 && xmlhttp.status==200) {
if(xmlhttp.responseText != $('body').val()) {
$('body').html(xmlhttp.responseText).fadeIn(500);
}
}
}
xmlhttp.open("GET","your_url_to_get_the_updated_page.php",true);
xmlhttp.send();
}
이 왜 지정된 간격으로 페이지를 새로 고침 할 것 VAR를 출력 사용 할 수있는? 목적은 무엇입니까? –