PHP页面显示刷新后的用户状态


PHP Page show user status with refresh

我有一个PHP脚本,它通过SOAP查询用户状态。当用户的状态发生变化时,例如当用户打电话或挂断电话时,我想刷新页面。如何快速平滑地刷新页面以始终显示最新的用户状态?

我阅读了关于Ajax的文章,并在HTML5中搜索了一个解决方案。你的建议是什么?

感谢任何有用的帖子:-)

我的建议是在页面加载之前不要加载和解释soap。

做两页。

1个内容页,显示您想要的所有内容,不包含"最新状态"加载内容页面后,向第二个页面发出ajax请求。(jQuery示例)

$(document).ready(function(){
   $.ajax("lateststatus.php").done(function(data){
      // Change the name of the element to the element where you want to display the data
      document.getElementById("mycontentdiv").innerHTML = data;
      });
});

然后在第二个php文件(lateststatus.php)中加载soap文件,只解释并生成要在内容div.中显示的html代码

简而言之就是这样。