我有这个.tpl
文件:
{include file="companies-list.tpl"}
我想使用div jQuery每隔5秒自动刷新一次{include file="companies-list.tpl"}
。
有可能吗?
答案 0 :(得分:1)
尝试这个
var refreshId = setInterval(function() {
jQuery("#divid").load(yourfilename,
function(response, status, xhr) {
if (status == "error") {
var msg = "Sorry but there was an error: ";
jQuery("#youdiv").html(msg + xhr.status + " " + xhr.statusText);
}
});
},5000);
答案 1 :(得分:0)
您需要一个只显示所包含文件的页面。
setInterval( function() { $('#yourdiv').load("companies-list.php"); }, 5000 );
这不理想(需要错误检查和超时等功能),但它应该让你走在正确的轨道上。