Tec*_*hDo 9 javascript asp.net twitter ajax jquery
I have very limited knowledge in jQuery. I need to develop a page which should show the count of new message posted. In twitter and stackoverflow websites, I have seen a div which shows the count of new tweet/questions posted and while clicking on it, the newer ones are shown on the top. Below added are the sample images:


Please suggest whether it can be attained using jQuery or Ajax. Thanks
这些例子看起来push不是pull行为.通过这个我的意思是服务器对页面说'嘿,这个标签中有一条新的推文'而不是页面询问'是否有任何新的推文?还没有?好的,我会在5秒内再问一次'.
由于您使用的是ASP.NET,因此可以使用良好的SignalR库轻松地将通知从服务器推送到客户端.
您仍然必须在服务器上检测到有新的"事物"并向匹配的客户端发送消息(带有signalR).并且还在客户端上处理消息并显示一段UI.
您需要使用$.ajax调用来检索新消息,您可以使用setTimeout每隔几分钟左右重复一次该调用。但要使 ajax 调用正常工作,您必须拥有某种可以从中检索数据的 API 端点。
这不仅仅是你可以通过在某个地方放入 jQuery 插件来构建并完成它的东西。在做任何事情之前,您需要了解 Javascript、jQuery 和您的特定 API。尝试查看jQuery 基本教程。
| 归档时间: |
|
| 查看次数: |
1160 次 |
| 最近记录: |