【发布时间】:2016-02-09 05:35:23
【问题描述】:
我有一个从数据库生成值的 php 文件,我希望该值在网站的标题框中不断显示。
我试过了:
<script>
function autoRefresh_title()
{
$.post("currentbank.php").done(function(response){
document.title(response)
setInterval('autoRefresh_title()', 1000);
</script>
上面的代码在 index.php 文件中,currentbank.php 是:
<?php
@include_once ("set.php");
$game = fetchinfo("value","info","name","current_game");
echo round(fetchinfo("cost","games","id",$game),2);
?>
PS:set.php 只是登录信息
【问题讨论】:
-
请确保问题是完整的(您在提供的代码中缺少很多右括号)。当代码失败时,您还应该提供一个简短的信息(假设它对您不起作用,因为您在这里询问)。
-
您只编辑了部分问题,javascript 代码可能仍然不完整(或@Akshay 提到的不正确)。
-
document.title 不是函数
标签: javascript php refresh title titlebar