0
웹캠에 대한 업데이트 기능을 만들려고합니다. 지금까지는 아약스 전화를 걸고 이미지의 URL을 제공합니다. 이미지를로드 한 후 결과를 DOM 요소 (ccam)에 바인딩하는 데 문제가 있습니다.dom 요소에 이미지 바인딩
function update() {
$('#loading').show('fast');
$.ajax({
type: 'POST',
url: 'cam.php',
data: 'img=<? echo $cam_id; ?>',
timeout: 2000,
cache: false,
success: function(data) {
window.setTimeout(update, 20000);
$('#currcam').hide();
$('#daycam').show();
$('#loading').hide('fast');
$('#ccam')
.append(img)
.append(html);
// now show the image
$(img).fadeIn();
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
$("#loading").html('Timeout contacting server..');
window.setTimeout(update, 60000);
}
});
}
$(document).ready(update);