我需要每分钟运行一次函数createChartControl 。每次执行该函数时,都应该更新DIV 容器GanttDiv的内容。问题是函数createChartControl只执行一次。如何正确添加计时器?
<script type="text/javascript" language="JavaScript">
function createChartControl(htmlDiv1)
{
// ...
}
(function(){
createChartControl('GanttDiv');
})();
</script>
<script>
$(document).ready(function() {
$("#GanttDiv").(function(){
createChartControl('GanttDiv');
})();
var refreshId = setInterval(function() {
$('#GanttDiv').fadeOut("slow", function () {
$(this).(function(){
createChartControl('GanttDiv');
})().fadeIn("slow");
});
}, 60000);
$.ajaxSetup({ cache: false });
});
</script>
<div style="width:100%; height:350px; position:relative" id="GanttDiv" class="GanttDiv"></div>