我有以下在 head 标签中调用的函数。
Page::IncludeJavascriptFile('js/packages.js');
Page::AddHeadElement('
<script type="text/javascript">
$(document).ready(function() {
pollClientTable('.TriplecastConfig::get('transfer_polling_period')*1000 .', true);
});
</script>
');
pollClientTable 在函数调用之前的 packages.js 中定义。
pollClientTable 函数:
var pollClientTableTimer = null;
var pollClientTableTimerPoll = null;
function pollClientTable(poll, async) {
clearTimeout(pollClientTableTimer);
$.ajax({
url: "ajax_requests/getClientPackages.php",
async: async,
timeout: poll,
success: function(data) {
$('#packagesForm').empty();
$('#packagesForm').append(data);
}
});
pollClientTableTimerPoll = poll;
pollClientTableTimer = setTimeout(function(){pollClientTable(poll, true);}, poll);
}
该功能可在任何其他浏览器栏 IE8 中使用。任何想法为什么?