我有这段代码,可以从Google电子表格生成HTML表格。我试图在电子表格加载的同时每隔5秒使表自动刷新一次。但是,使用以下代码时,它只会使表在5秒后消失。有没有人看到有什么问题或有更好的解决方案?
<div class="sheetstotables"></div>
<script type="text/javascript">
var tableId = "AB12C"
var x = document.createElement("script"); x.type = "text/javascript"; x.async = true;
x.src = "http://www.sheetstotables.com/get_table.js";
var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(x, s);
</script>
<script>
function autoRefresh_div()
{
$(".sheetstotables").load("load.html");// a function which will load data from other file after x seconds
}
setInterval('autoRefresh_div()', 5000); // refresh div after 5 secs
</script>