2009-02-28 102 views
0

我正在尝试为摄像头设置更新功能。到目前为止,它做的是一个Ajax调用并为图像的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); 

回答

0

之前,我可以回答你的问题,请注明这到底是怎么回事:

$('#ccam').append(img).append(html); 

中有什么img var和什么是在html变种?

相关问题