需要刷新页面内容页面、内容

2023-09-10 19:33:19 作者:奥利奥根本扭不开

我使用codeigniter框架的工作,目前正在对社交类的东西。我的问题是,我需要与出通知其朋友活动的用户重新加载页面,当用户点击供稿链接。 我曾尝试下面的脚本,

I am using codeigniter frame work and currently working on social networking kind of stuff. My problem is, i need to notify the user of their friends activity with out reloading the page when the user clicks on the feeds link. I have tried the following script,

<script>
setInterval(function() {
$('#reload').fadeOut("slow").load('user_feeds').fadeIn("slow");
}, 10000);
</script>

它增加了负载到我的服务器。任何其他的想法实现这个目标。

It increases the load to my server. any other idea for accomplishing this.

在此先感谢。

推荐答案

这其实是一个很有趣的问题,你需要的是对的 COMET 。有一个事件彗星称为COMETD路由总线。 COMETD也有JavaScript实现,并具有jQuery的绑定。 http://cometd.org/documentation/2.x/cometd-javascript

This is actually a very interesting problem, what you need is an implementation of COMET .There is an event routing bus using comet called COMETD. COMETD also has javascript implementation and has bindings for Jquery. http://cometd.org/documentation/2.x/cometd-javascript