我有一个从数据库生成值的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只是登录信息
答案 0 :(得分:2)
document.title(response);
更改为:
document.title = response;